CMP2003 Lecturenotes Week9
CMP2003 Lecturenotes Week9
CMP2003 Lecturenotes Week9
Chapter 9
Searching Algorithms
Objectives
• Item key
– Unique member of the item
– Used in searching, sorting, insertion, deletion
• Number of key comparisons
– Comparing the key of the search item with the key of
an item in the list
• We can use class arrayListType (Chapter 3)
– For easy reference
– Implements a list and basic operations in an array
• Array-based lists
– Covered in Chapter 3
• Linked lists
– Covered in Chapter 5
• Works the same for array-based lists and linked lists
• See code on page 499
• Chapter 9 – Exercise 1
• Chapter 9 – Exercise 2