Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ordered Lists and Sorted Lists Chapter 7. Ordered Lists Array version vs. Linked-list version.

Similar presentations


Presentation on theme: "Ordered Lists and Sorted Lists Chapter 7. Ordered Lists Array version vs. Linked-list version."— Presentation transcript:

1 Ordered Lists and Sorted Lists Chapter 7

2 Ordered Lists Array version vs. Linked-list version

3 List, Ordered List and Sorted List Hierarchy

4 Searchable Container Operations Insert: put objects into the container Withdraw: remove objects from the container Find: locate objects in the container IsMember: test whether a given object instance is in the container

5 Ordered Lists Additional operations: FindPosition: find the position of an object in the ordered list Operator [ ]: access the object at a given position in the ordered list Withdraw( Position&): remove the object at a given position from the ordered list InsertAfter: insert an object into the ordered list after the object at a given position InsertBefore: Insert an object before the object at a given position

6 List and Ordered List Class Definition

7 Array Implementation

8 Constructor, Insert(), and [ ]

9 IsMember() and Find()

10 Withdraw()

11 Pos Class

12 FindPosition() and [ ]

13 Insert at Arbitrary Position

14 InsertAfter()

15 Withdraw an Item

16 Withdraw()

17 Linked List Implementation

18 Constructor, Insert() and [ ]

19 IsMember() and Find()

20 Withdraw()

21 Pos Class

22 FindPosition()

23 InsertAfter()

24 Withdraw()

25 Sorted Lists Additional operations: FindPosition: find the position of an object in the sorted list Operator [ ]: access the object at a given position in the sorted list Withdraw: remove the object at a given position from the sorted list

26 SortedList Class Definition

27 Array Implementation

28 Inserting Items in a Sorted List

29 Insert()

30 Binary Search

31 Finding Items

32 Withdraw()

33 Linked List Implementation

34 Insert()


Download ppt "Ordered Lists and Sorted Lists Chapter 7. Ordered Lists Array version vs. Linked-list version."

Similar presentations


Ads by Google