Linked List :
Node(1) -> Node(2) -> Node(3) -> Node(4) -> Node(5) -> Node(6) -> Node(7)
- In linked list, the items are linked together through a single next pointer.
- Next Node’s Key Can be larger or samller then previous Node.
- Not Sorted
- Time Complexity of Search :O(n) Insert : O(1) Delete : O(1) {if you have use optimized method }
Binary Search Tree:
[4] / \ [2] [6] / \ / \ [1] [3] [5] [7]
- In a binary tree, each node can have 0, 1 or 2 sub nodes.
- The key of the left node is lesser than the key of the node and the key of the right node is more than the node
- Sorted
- Time Complexity of Search : O(log(n)) Insert : O(log(n)) Delete : O(log(n))
References:
http://bigocheatsheet.com/