Posts

Showing posts from September, 2020

Linked List VS Array

1) Linked list Definition :- Linked lists are the collection of node, which are dynamically created and nodes are li ked together by the pointer reference.  Advantages :- 1) Linked list size is not fixed , they can expand and shrink.  2) Insertion and Deletion operations are fast and easier with O(1) complexity.  3) Data Structures like stacks , queues , and trees can be implemented  using linked lists.  Disadvantages :- 1) Memory consumption is more , since every node need extra pointer in order to connect to next node.  2) Sequential access only possible, random access can't be achieved.  3) Reverse traversing is not possible.  Application :- => Suppose, I want to develop an application, such that it should respond quickly and more memory consumption is not a problem , In this case we use Li ked Lists in our applications.  2) Array Definition :- Array is the collection of homogeneous data types.  Advantage :- 1) Array can be accessed randomly using the array index.