1 / 12

Lab - 11

Lab - 11. Keerthi Nelaturu. Ordered Structure. Using Doubly linked list All elements in the list are arranged in an order Implement the Ordered Structure interface Methods : Add Get Remove Merge Size. OrderedList Class.

geri
Download Presentation

Lab - 11

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. Lab - 11 KeerthiNelaturu

  2. Ordered Structure • Using Doubly linked list • All elements in the list are arranged in an order • Implement the Ordered Structure interface Methods : • Add • Get • Remove • Merge • Size

  3. OrderedList Class • Create a class OrderedList implement OrderedStructure interface • Add another nested static class Node • Node is an element in the Doubly Linked List Tail Head Node Node Value Of type Comparable

  4. Node

  5. Size

  6. Add Conditions to consider : • Check for null value passed in the parameter • Check for empty list • Check if the first element in the list is greater than equal to value passed • There is one node which is greater than value passed

  7. Add

  8. Get (pos)

  9. Remove (pos) Three cases to consider • If the position is less than 0 throw exception • If position is 0 • Intermediate node

  10. Position is 0

  11. Intermediate position

  12. Merge another List

More Related