Postingan

Linked List

Gambar
Linked List vs Array Array  : ·          Linear collection of data elements ·          Store value in consecutive memory locations ·          Can be random in accessing of data Linked List  : ·          Linear collection of nodes ·          Doesn’t store its nodes in consecutive memory locations ·          Can be accessed only in a sequential manner Single Linked List is a linked list which node contain only a  single link to other node To create a linked list, we need to  define a node structure Insert To insert a new value, first we should dynamically  allocate a new node  and  assign the value to it  and then  connect it  with the existing linked list. ·          In front of the head Delete To delete a value, first we should  find the location  of node which store the value we want to  delete, remove it, and connect  the remaining linked list. There are two conditions we should pay