49
Topic 9 Linear Search and Hash Tables

Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Embed Size (px)

DESCRIPTION

FunSort FunSort(list, low, high) returns list if (low < high) then FunSort(list, low, high-1) if list[high-1] > list[high] then swap list[high-1] and list[high] FunSort(list, low, high-1) end if end FunSort

Citation preview

Page 1: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Topic 9

Linear Search and

Hash Tables

Page 2: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Announcements

• Participation due tomorrow

• FunSort explanation posted

Page 3: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

FunSortFunSort(list, low, high) returns list

if (low < high) thenFunSort(list, low, high-1)if list[high-1] > list[high] then

swap list[high-1] and list[high]FunSort(list, low, high-1)

end ifend if

end FunSort

Page 4: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

FunSort TL;DR

5 4 3 2 1…3 4 5 2 1

Page 5: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

More on Homework 4

• Program argumentspublic static void main(String[] args){ for (int i = 0; i < args.length; i++) System.out.println(args[0]);} bash$ java cs345_prog1 hello worldhelloworld

• Images

Page 6: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 7: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 8: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Searching

Definition:

Page 9: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Searching Unsorted Array

Page 10: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 11: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Jump Search

Page 12: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 13: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 14: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Binary Search

Page 15: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 16: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Interpolation/Phonebook Search

0 … 8946 … 9999

Page 17: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 18: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

N Log(n) Log(log(n))

Page 19: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Hash Tables

Definition:

Page 20: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Division Method

Page 21: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 22: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 23: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Multiplication Method

Page 24: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 25: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 26: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

MAD (Multiply, Add, and Divide)

Page 27: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Considerations

Page 28: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Collisions

Page 29: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Chaining

Page 30: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Open Addressing

Page 31: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Linear Probing

Page 32: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 33: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Quadratic Probing

Page 34: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 35: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Double Hashing

Page 36: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 37: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Deletion

• Chaining

Page 38: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

• Open Addressing

Page 39: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Runtime Analysis

Page 40: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Perfect Hashing

Page 41: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Universal Hash Function

Page 42: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 43: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 44: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted

Bloom Filters

Page 45: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 46: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 47: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 48: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted
Page 49: Topic 9 Linear Search and Hash Tables. Announcements Participation due tomorrow FunSort explanation posted