Titles make PowerPoint happy.

Slides:



Advertisements
Similar presentations
0 Course Outline n Introduction and Algorithm Analysis (Ch. 2) n Hash Tables: dictionary data structure (Ch. 5) n Heaps: priority queue data structures.
Advertisements

B+-tree and Hashing.
CSE 326: Data Structures Hashing Ben Lerner Summer 2007.
Unit 11a 1 Unit 11: Data Structures & Complexity H We discuss in this unit Graphs and trees Binary search trees Hashing functions Recursive sorting: quicksort,
COMP 171 Data Structures and Algorithms Tutorial 10 Hash Tables.
E.G.M. PetrakisB-trees1 Multiway Search Tree (MST)  Generalization of BSTs  Suitable for disk  MST of order n:  Each node has n or fewer sub-trees.
Different Tree Data Structures for Different Problems
COSC2007 Data Structures II
Design and Analysis of Algorithms CSC201 Shahid Hussain 1.
Brought to you by Max (ICQ: TEL: ) February 5, 2005 Advanced Data Structures Introduction.
David Luebke 1 10/25/2015 CS 332: Algorithms Skip Lists Hash Tables.
Tirgul 11 Notes Hash tables –reminder –examples –some new material.
Review for Final Exam Non-cumulative, covers material since exam 2 Data structures covered: –Treaps –Hashing –Disjoint sets –Graphs For each of these data.
Advanced Data Structure By Kayman 21 Jan Outline Review of some data structures Array Linked List Sorted Array New stuff 3 of the most important.
CS6045: Advanced Algorithms Data Structures. Hashing Tables Motivation: symbol tables –A compiler uses a symbol table to relate symbols to associated.
Exam 3 Review Data structures covered: –Hashing and Extensible hashing –Priority queues and binary heaps –Skip lists –B-Tree –Disjoint sets For each of.
MA/CSSE 473 Day 30 Optimal BSTs. MA/CSSE 473 Day 30 Student Questions Optimal Linked Lists Expected Lookup time in a Binary Tree Optimal Binary Tree (intro)
Data Structures for Disjoint Sets Manolis Koubarakis Data Structures and Programming Techniques 1.
Data Structures and Algorithms
Chapter 11 Sorting Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++, Goodrich, Tamassia and Mount.
CSE373: Data Structures & Algorithms Priority Queues
Week 7 - Friday CS221.
Hash table CSC317 We have elements with key and satellite data
CSCI 210 Data Structures and Algorithms
Data Structures and Algorithms
CSE 332 Data Abstractions B-Trees
Binary Search Trees.
Datastructure.
Dynamic Order Statistics
EEE2108: Programming for Engineers Chapter 8. Hashing
Week 11 - Friday CS221.
Hashing Exercises.
Review for Final Exam Non-cumulative, covers material since exam 2
Review for Final Exam Non-cumulative, covers material since exam 2
ITEC 2620M Introduction to Data Structures
Dynamic Dictionaries Primary Operations: Additional operations:
Review for Final Exam Non-cumulative, covers material since exam 2
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
structures and their relationships." - Linus Torvalds
Advanced Associative Structures
CSE373: Data Structures & Algorithms Lecture 10: Disjoint Sets and the Union-Find ADT Linda Shapiro Spring 2016.
Introduction to Database Systems
Data Structures and Algorithms
CSE373: Data Structures & Algorithms Lecture 10: Disjoint Sets and the Union-Find ADT Linda Shapiro Winter 2015.
(2,4) Trees /26/2018 3:48 PM (2,4) Trees (2,4) Trees
Teach A level Computing: Algorithms and Data Structures
CPSC 221: Algorithms and Data Structures Lecture #6 Balancing Act
(2,4) Trees (2,4) Trees (2,4) Trees.
Hash-Based Indexes Chapter 11
Index tuning Hash Index.
CMSC 202 Trees.
CS202 - Fundamental Structures of Computer Science II
Database Systems (資料庫系統)
(2,4) Trees /24/2019 7:30 PM (2,4) Trees (2,4) Trees
Hashing Sections 10.2 – 10.3 Lecture 26 CS302 Data Structures
CS 332: Algorithms Amortized Analysis Continued
(2,4) Trees (2,4) Trees (2,4) Trees.
CSE 373: Data Structures and Algorithms
Multiway Search Tree (MST)
Review for Final Exam Non-cumulative, covers material since exam 2
CSE 373 Data Structures and Algorithms
CSE 326: Data Structures Lecture #9 AVL II
CSE 373: Data Structures and Algorithms
Priority Queues Supports the following operations. Insert element x.
CSE 326: Data Structures Lecture #24 Odds ‘n Ends
Data Structures and Algorithm Analysis Priority Queues (Heaps)
CO4301 – Advanced Games Development Week 12 Using Trees
CSE 326: Data Structures Lecture #14
structures and their relationships." - Linus Torvalds
CSE 373: Data Structures and Algorithms
Presentation transcript:

Titles make PowerPoint happy. This is a title Titles make PowerPoint happy.

Up-Trees (not as much work as it looks) Perform Disjoint Union-Find operations on Up-Tree with path compression and using weight (# of nodes) in merges. Starting with empty tree. Keep track of (sub)tree weight, and pointers into tree (pointers isn’t too hard) Vaguely have a sense of # of operations (e.g. edge traversals) For items: a,b,c,d,e,f,g,h,i,j,k Union (a,b). Union (b,c). Union (d,e). Union (d,f). Union (d,j). Union (d,k). Union (e,g). Union (h,i). Union (c,h). Union (c,f). Find (i). Find (b). Find (c). Find (i). Find (h).

Make a nicely-connected Maze (diagram on next page) Make a random 3x3 maze with exactly one path between any two points Simulate up-trees (or don’t if you feel comfortable) Use edge order (first edge, second edge,…) on next page. Feel the power of the Dark Side

Order of edges:

BTW Show that -notation is an equivalence relation. Formal proofs not necessary. Contemplate putting functions into up-trees based on -notation (but not for too long…)

Hashing functions Hash table size 7, key=integers Consider this hashing function: H(X)= X mod 7 What patterns of (distinct) keys would cause only one bucket to be used? (answer on next page)

Hashing functions cont’d One answer: 0,7,14,21,28,… Integers may have a reason to be multiples of 7 (probably even worse if you’re hashing strings of English words – very biased data)

Hashing functions… How about this hashing function: given a parameters A,B,K: HA,B,K(X)=(A*X+B mod 7K)/K What patterns would cause only one bucket to be used? For a given bad pattern, can you find different values of A,B,K to make this pattern OK (defeat your adversary)? Given a patterns, if you ran your program many times with random A,B,K, what’s the average performance? If you knew the data ahead of time, how could you design a really good hashing function?

Extendible Hashing In the extendible hash table on the next page, perform the following inserts: 0100 0101

Extendible Hashing: table so far… 00 01 10 11 0001 0110 0111 1000 1010 1001 1111 1100 Note: Buckets can store up to 3 keys before overflowing

Binomial Queues Merge these binomial queues: From Introduction to Algorithms, Cormen et. al, pp 410-411.

Tricks & Leaps with Treaps What happens when you insert this into a BST: 1,2,3,4,5,… What about a treap? Create a sequence of random numbers that’d create a perfectly balanced Treap for 1,2,3,4,5… What should the range of your random priorities be? What are bad properties for the random-number generator?

Traverse & not-too Deep: Treaps Insert key 18 with random priority 2 into this Treap (don’t worry about “proper” way to rotate):