UBS Interview Question

Linked list in java is singly or doubly, why doubly and not singly, write prog to detect loop in linked list

Interview Answer

Anonymous

Sep 24, 2018

we can use set/hash to add elements to find duplicate one or we can use length, if looping exceeds length it is possibly a loop, we cannot compare 2 elements in the linked list, as the same element can be present twice, he was expecting Floyd’s algo which I was not aware of at the time.