Write code to remove duplicates from an unsorted linked list
This longer than I care to admit to figure out/understand.
Basically, there are two parts this. We need to see if something is a duplicate, so I will use a hashtable to keep track of the different objects that I come across. Next, in order to remove a linkedlist node, we need to keep track of where the previous node is, that way we can do a
previous.next = currentNode.next. This will remove the currentNode from the Linked List.
No comments:
Post a Comment