1 / 6

The Linked List

The Linked List. CS 145 Spring 2005. List. Node. Node. Node. First. Next. Next. Null. Data. Data. Data. Basic Linked List (AKA Singly Linked List). type Node; type Node_Ptr is access Node; type Node is record Next : Node_Ptr; Data : <<whatever>>; end record;.

Download Presentation

The Linked List

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. The Linked List CS 145 Spring 2005

  2. List Node Node Node First Next Next Null Data Data Data Basic Linked List(AKA Singly Linked List) type Node; type Node_Ptr is access Node; type Node is record Next : Node_Ptr; Data : <<whatever>>; end record; subtype List is Node_Ptr; or, type List is record First : Node_Ptr; end record;

  3. List Node Node Node First Next Next Null DataPtr DataPtr DataPtr Data Data Data … … … Basic Linked List (Variation 1)Point to Data type Node; type Node_Ptr is access Node; type Node is record Next : Node_Ptr; Data : access <<whatever>>; end record; subtype List is Node_Ptr; or, type List is record First : Node_Ptr; end record;

  4. Node Node Node Next Next Null Data Data Data Linked List (Variation 2)Last Pointer List First Last type Node; type Node_Ptr is access Node; type Node is record Next : Node_Ptr; Data : <<whatever>>; end record; type List is record First : Node_Ptr; Last : Node_Ptr; end record;

  5. Node Node Node Next Next Null Data Data Data Linked List (Variation 3)Keep a Count List First Last Count type Node; type Node_Ptr is access Node; type Node is record Next : Node_Ptr; Data : <<whatever>>; end record; type List is record First : Node_Ptr; Last : Node_Ptr; Count : Natural; end record;

  6. Node Node Node Next Next Null Null Prev Prev Data Data Data Doubly Linked List(with Optional Count) List First Last Count type Node; type Node_Ptr is access Node; type Node is record Next : Node_Ptr; Prev : Node_Ptr; Data : <<whatever>>; end record; type List is record First : Node_Ptr; Last : Node_Ptr; Count : Natural; end record;

More Related