Wednesday, May 31, 2017

Linked Lists

Single linked lists:
   - Each element point to next
   - Start pointer is available
   - To get pointer to last element u need to traverse the whole list. ( circular linked list improve this )
   - If you have a pointer to an elememt and you wamt to get the previous element, you have to traverse the whole list ( double linked list improves this )

Circular linked list
    - last element points to first element.
    - last element pointer is available. And first element can be got from it.

Double linked list
    - Each element points to previous and next elements
    - More storage is needed than single linked list
    - More operations to insert and delete
    - No need to traverse whole array to get previous element
    - Traversing a list is possible in both directions

No comments:

Post a Comment