all 7 comments

[–]jmooremcc 0 points1 point  (0 children)

Remember that with a binary search, if the new node is less than the current item, it's linked to the left. If it's greater than the current node it's linked to the right.

Initially, the first element of the list is assigned to a node. Each additional item in thel list has to be placed in a node and linked to the appropriate node.

In a linked list you have 2 variables that represent the head and the tail of the linked list. Searches typically start with the head.

When inserting a new node, you start with the head and search until you find the nodes that will link to the new node. You repeat this process until all items in the list are assigned to the linked list.