1 / 7

LINKED LIST Presented By Engr . Reema Tariq Mughal

LINKED LIST Presented By Engr . Reema Tariq Mughal. What is Link List ?. Various cells of memory are not allocated consecutively in memory . With arrays, the second element was right next to the first element.

dianne
Download Presentation

LINKED LIST Presented By Engr . Reema Tariq Mughal

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LINKED LISTPresented By Engr. Reema Tariq Mughal

  2. What is Link List ? • Various cells of memory are not allocated consecutively in memory. • With arrays, the second element was right next to the first element. • Now the first element must explicitly tell us where to look for the second element. • Do this by holding the memory address of the second element

  3. object next Linked List • Create a structure called a Node. • The object field will hold the actual list element. • The next field in the structure will hold the starting location of the next node. • Chain the nodes together to form a linked list.

  4. head 2 6 8 7 1 size=5 current Linked List • Picture of our list (2, 6, 7, 8, 1) stored as a linked list:

  5. Linked List Note some features of the list: • Need a head to point to the first node of the list. Otherwise we won’t know where the start of the list is. • The current here is a pointer, not an index. • The next field in the last node points to nothing. We will place the memory address NULL which is guaranteed to be inaccessible

  6. 2 Linked List • Actual picture in memory: 1051 6 1052 1063 current 1053 1063 1054 2 head 1055 1051 1056 6 8 7 1 1057 7 1058 1060 current 1059 1060 1 1061 0 head 1062 1054 1063 8 1064 1057 1065

  7. Linked List Operations • Link list operations can be better understood with the help of C Programming.

More Related