Augmented Data Structures and the Test

Slides:



Advertisements
Similar presentations
David Luebke 1 6/7/2014 CS 332: Algorithms Skip Lists Introduction to Hashing.
Advertisements

Interval Heaps Complete binary tree. Each node (except possibly last one) has 2 elements. Last node has 1 or 2 elements. Let a and b be the elements in.
AVL Trees Balancing. The AVL Tree An AVL tree is a balanced binary search tree. What does it mean for a tree to be balanced? It means that for every node.
Data Abstraction and Problem Solving with JAVA Walls and Mirrors Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Data Abstraction and Problem.
CS 240: Data Structures Tuesday, July 24 th Searching, Hashing Graphs.
CSE332: Data Abstractions Lecture 7: AVL Trees Tyler Robison Summer
CS 280 Data Structures Professor John Peterson. Invariants Back to Invariants! Recall the insertion sort invariant – how can we turn this into debugging.
1 Binary Search Trees Implementing Balancing Operations –AVL Trees –Red/Black Trees Reading:
CS 206 Introduction to Computer Science II 12 / 01 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 11 / 24 / 2008 Instructor: Michael Eckmann.
© 2006 Pearson Addison-Wesley. All rights reserved13 B-1 Chapter 13 (excerpts) Advanced Implementation of Tables CS102 Sections 51 and 52 Marc Smith and.
CS 106 Introduction to Computer Science I 10 / 16 / 2006 Instructor: Michael Eckmann.
Week 14 - Monday.  What did we talk about last time?  Image manipulation  Inheritance.
Setting up IC to use a 4 Point Scale Created by North High School 2013.
CSC207 Software Design Summer 2011 Lecturer: Hesam C. Esfahani
Balancing Binary Search Trees. Balanced Binary Search Trees A BST is perfectly balanced if, for every node, the difference between the number of nodes.
© 2006 Pearson Addison-Wesley. All rights reserved13 B-1 Chapter 13 (continued) Advanced Implementation of Tables.
1 Searching Searching in a sorted linked list takes linear time in the worst and average case. Searching in a sorted array takes logarithmic time in the.
AVL Trees Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignments? zYour minute essay last.
Week 8 - Wednesday.  What did we talk about last time?  Level order traversal  BST delete  2-3 trees.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
CS 106 Introduction to Computer Science I 03 / 02 / 2007 Instructor: Michael Eckmann.
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.
CSE373: Data Structures & Algorithms Lecture 7: AVL Trees Linda Shapiro Winter 2015.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
Week 9 - Friday.  What did we talk about last time?  Collisions  Open addressing ▪ Linear probing ▪ Quadratic probing ▪ Double hashing  Chaining.
Red-Black Trees Opening Discussion zDo you have any questions about the quiz? zWhat did we talk about last class? zDo you have any questions.
1 Binary Search Trees  Average case and worst case Big O for –insertion –deletion –access  Balance is important. Unbalanced trees give worse than log.
CSE332: Data Abstractions Lecture 7: AVL Trees
MA/CSSE 473 Day 20 Finish Josephus
AVL Trees 5/17/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M.
Week 7 - Friday CS221.
Data Structures Binary Trees 1.
Lecture No.43 Data Structures Dr. Sohail Aslam.
Balancing Binary Search Trees
Week 6 - Wednesday CS221.
Week 8 - Friday CS221.
Chapter 6 Transform-and-Conquer
CSE373: Data Structures & Algorithms Lecture 7: AVL Trees
Cse 373 May 15th – Iterators.
Red-Black Trees 9/12/ :44 AM AVL Trees v z AVL Trees.
Week 11 - Friday CS221.
Week 14 - Wednesday CS 121.
CSE373: Data Structures & Algorithms Lecture 7: AVL Trees
Red-Black Trees Motivations
More on Merge Sort CS 244 This presentation is not given in class
Red-Black Trees 11/13/2018 2:07 AM AVL Trees v z AVL Trees.
original list {67, 33,49, 21, 25, 94} pass { } {67 94}
Chapter 6 Transform and Conquer.
Red-Black Trees 11/26/2018 3:42 PM AVL Trees v z AVL Trees.
CPSC 221: Algorithms and Data Structures Lecture #6 Balancing Act
Reporting (1-D) Given a set of points S on the line, preprocess them to build structure that allows efficient queries of the from: Given an interval I=[x1,x2]
Heaps and the Heapsort Heaps and priority queues
Hash Tables and Associative Containers
CSE 214 – Computer Science II B-Trees
CSE373: Data Structures & Algorithms Lecture 5: AVL Trees
ADTs so far.
CSE 332: Data Abstractions AVL Trees
CSE 373: Data Structures and Algorithms
Lecture No.20 Data Structures Dr. Sohail Aslam
Advanced Implementation of Tables
Advanced Implementation of Tables
AVL Trees 2/23/2019 AVL Trees v z AVL Trees.
Red-Black Trees 2/24/ :17 AM AVL Trees v z AVL Trees.
Amortized Analysis and Heaps Intro
Bitcoin Data Structures
Division With Remainders Grids
Richard Anderson Spring 2016
Red-Black Trees 5/19/2019 6:39 AM AVL Trees v z AVL Trees.
CS 261 – Data Structures AVL Trees.
Presentation transcript:

Augmented Data Structures and the Test 10-21-2003

Opening Discussion What did we talk about in the class before the test? Do you have any questions about the assignment? Test Results 5 As, 2 Bs, 4 Cs, 4 Ds, 5 Fs

Test Comments Question 1 uses a division hashing scheme with linear probing. Can someone explain % for me? How does linear probing resolve collisions? Show some work so I can give you a bit of partial credit. Anything to left of -> (or . in Java) can cause a seg fault (NullPointerException). You need to check. No loops.

More Test Comments Smart test taking is just as important as anything. Leaving blanks made my grading easier, but I don’t like writing the -10. Discussion on the difficulty of the course and the test.

Skip Lists This is another data structure that can give you O(log n) behavior. It is not a tree. In this data structure we keep multiple parallel sorted linked lists with each list being longer than the one before it. The trick is keeping track of the right elements.

Augmented Data Structures This is an idea that we have already talked about, but now we can make it more formal. Sometimes you can use just a basic, preexisting data structure, but often you can’t. We have already talked about order statistic trees where we put a size in the element. This can be done with a regular tree, or a balanced tree like an AVL or Red-Black tree.

Augmenting and Speed The trick to augmenting a data structure is making sure that you can keep the values up to date without messing up the order of the different methods. For a tree we can prove augmentation is safe if the value in a node can be calculated from the value in the children. This is the case for size and height.

Interval Trees Another potential augmentation for a tree is to make an interval tree. This is a tree that keeps tracks of intervals of values instead of single values. We sort them by the low end of the interval. To help us use them we also store the maximum of any interval under a given node. Again, this works with balanced or unbalanced trees.

Code Let’s continue writing our binary tree code and now we will augment it so that we have an ordered statistic tree.

Minute Essay Draw a picture of what a skip list might look like for the values 1, 3, 4, 5, 7, 9 13, 15. Assignment #3 is due a week from today.