Disadvantages LinkedList Java Example

Disadvantages LinkedList Java Example

Disadvantages of LinkedList:

  • Randon access not allowed: In case of LinkedList random access is not allowed you have to access each and every node sequentially. Support if you want to access nth elment in the node you will have to traverse the LinkedList nth time which is O(n) but in case of Arrays this is much faster by using a(n) because it has fixed postion for elements.
  • Extra momory space: Linked list store element in nodes where one bucket is assigned for value and another is required for pointer so we can say its memory wastage in terms of taking extra space for pointer
  • Extra time in terms of search: Linked list can not be randomly accessed so searching element in LinkedList takes extra time. For example if you are seaching an element in LinkedList it will take O(n) time becuase it will search element squentially which will start from first node whereas in Arrays this time will be O(1).
  • Memory heap space location issue: In LinkedList momory allocated dynamically only at run-time and of-course it depends on if space is avaible on the heap. Imagine if there is not sufficient space available on heap the then it can be allocated and you will get out of memory at run time.
  • Reverse traversing: In case of singly LinkedList list reverse traversing is not possible because end pointer does not connect to start pointer. But in case of double Linked list its possible but to point end to start take extra memory space.

Types of Linked List

  • Singly linked list
  • Doubly linked list
  • Multiply linked list
  • Circular Linked list
  • Circular Linked list


Leave a Reply

Your email address will not be published. Required fields are marked *