1 / 12

Linked Lists

Data Structure: Chapter 5. Min Chen School of Computer Science and Engineering Seoul National University. Linked Lists. Content. Understanding Linked List Operators for Linked List Insert Remove Display Search Sorted Lists. Understanding Linked Lists.

lynn-nelson
Télécharger la présentation

Linked Lists

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. Data Structure: Chapter 5 Min Chen School of Computer Science and Engineering Seoul National University Linked Lists

  2. Content • Understanding Linked List • Operators for Linked List • Insert • Remove • Display • Search • Sorted Lists

  3. Understanding Linked Lists • Defined by Relationship, not Position • For array, stack, queue • Relationship is represented by position • For linked list • Relationship is represented by links Value Field Link Field

  4. Circular Lists • There is no end in Circular List • All items have next hop

  5. Doubly Linked List • Shortcoming of singly linked list • Difficult to travel back! • Addressed by Doubly Linked List

  6. Operators : Insert • Insert item into the linked list Fig.1 Insert Operator in Linked List

  7. Operators : Remove • Remove item from the linked list Fig.2 Remove Operator in Linked List

  8. Operators : Display • Display all the items in the linked list 21 3 87 238 46 379 Display: 87 Display: 46 Display: 21 Display: 3 Display: 238 Display: 379 Fig.3 Display Operator in Linked List

  9. Operators : Search • Search value 238 in the linked list 21 3 87 238 46 379 Found 238 ! Fig.4 Search Operator in Linked List

  10. Operators for Doubly Linked List • Similar to Singly Linked Lists • Pay attention to the link redirection

  11. Sorted Lists • As implied by the name, the items in the sorted lists are sorted by a key as in ordered array 24 35 72 30

  12. Thank you!

More Related