Hashing - 1 Course Outline Course Outline C++ Review (Ch....

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Course Outline Course Outline C++ Review (Ch. 1) Algorithm Analysis (Ch. 2) Sets with insert/ delete/ member: Hashing (Ch. 5) Sets in general: Balanced search trees (Ch. 4, 12.2) Sets with priority: Heaps, priority queues (Ch. 6) Graphs: Shortest-path algorithms (Ch. 9.1 9.3.2) Sets with disjoint union: Union/ Find (Ch. 8.18.5) Graphs: Minimum spanning trees (Ch. 9.5) Sorting (Ch. 7) 2 Data Structures for Sets Data Structures for Sets Many applications deal with sets. Compilers have symbol tables (set of vars, classes) Dictionary is a set of words. Routers have sets of forwarding rules. Web servers have set of clients, etc. A set is a collection of members No repetition of members Members themselves can be sets Examples Set of first 5 natural numbers: {1,2,3,4,5} {x | x is a positive integer and x < 100} {x | x is a CA driver with > 10 years of driving experience and 0 accidents in the last 3 years} 3 Set Operations Set Operations Unary operation: min, max, sort, makenull, Binary operations Member Set Member Order (=, <, >) Find, insert, delete, split, Set Find, insert, delete, split, Union, intersection, difference, equal, 4 Observations Observations Set + Operations define an ADT. A set + insert, delete, find A set + ordering Multiple sets + union, insert, delete Multiple sets + merge Etc. Depending on type of members and choice of operations, different implementations can have different asymptotic complexity. 5 Set ADT: Union, I ntersection, Difference Set ADT: Union, I ntersection, Difference AbstractDataType SetUI D instance multiple sets operations union ( s1,s2 ) : {x | x in s1 or x in s2} inter section ( s1,s21 ) : {x | x in s1 and x in s2} differ ence ( s1,s2 ) : {x | x in s1 and x not in s2} 6 Examples Examples Sets: Articles in Yahoo Science (A), Technology (B), and Sports (C) Find all articles on Wright brothers. Find all articles dealing with sports medicine Sets: Students in CS10 (A), CS20 (B), and CS40 (C) Find all students enrolled in these courses Find students registered for CS10 only Find students registered for both CS10 and CS20 Etc. 7 Set UI D I mplementation: Bit Vector Set UI D I mplementation: Bit Vector Set members known and finite (e.g., all students in CS dept) Operations Union: u[k]= x[k] | y[k]; I ntersection: u[k] = x[k] & y[k]; Difference: u[k] = x[k] & ~y[k]; Complexity: O(n): n size of the set 1 0 1 1 1 1 1 1 1 students courses A set 8 Set UI D I mplementation: linked lists Set UI D I mplementation: linked lists Bit vectors great when Small sets Known membership Linked lists Unknown size and members Two kinds: Sorted and Unsorted 9 Set UI D Complexity: Set UI D Complexity: Unsorted Unsorted Linked List Linked List I ntersection For k=1 to n do Advance set A one step to find kth element; Follow set...
View Full Document

Page1 / 42

Hashing - 1 Course Outline Course Outline C++ Review (Ch....

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online