Home / Expert Answers / Computer Science / answer-in-prolog-please-write-a-predicate-called-noduplicates-l1-l2-noduplicates-l1-l2-pa155

(Solved): Answer in prolog please Write a predicate called noDuplicates (L1,L2). noDuplicates (L1,L2 ...



Answer in prolog please

Write a predicate called noDuplicates \( (\mathrm{L} 1, \mathrm{~L} 2) \). noDuplicates \( (\mathrm{L} 1, \mathrm{~L} 2) \) i

Write a predicate called noDuplicates . noDuplicates is true if has the same elements in the same order as L1, but with all duplicates removed. For example: noDuplicates is true noduplicates is false noduplicates ([dog, cat, hamster, dog, birb], [cat, hamster, dog, birb]) is true Hint: counter-intuitively, it is easier to keep the last appearance of a duplicate element than the first. You can see this in the third example. (If you write a working version of noDuplicates that keeps the first appearance instead of the last, you won't lose marks, but I recommend keeping the last.)


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe