Review for Exam 2 Topics covered: –Recursion and recursive functions –General rooted trees –Binary Search Trees (BST) –Splay Tree –RB Tree –K-D Trees For.

Slides:



Advertisements
Similar presentations
Definitions and Bottom-Up Insertion
Advertisements

Splay Tree Algorithm Mingda Zhao CSC 252 Algorithms Smith College Fall, 2000.
Comp 122, Spring 2004 Binary Search Trees. btrees - 2 Comp 122, Spring 2004 Binary Trees  Recursive definition 1.An empty tree is a binary tree 2.A node.
Binary Trees, Binary Search Trees CMPS 2133 Spring 2008.
Priority Queues And the amazing binary heap Chapter 20 in DS&PS Chapter 6 in DS&AA.
AA Trees another alternative to AVL trees. Balanced Binary Search Trees A Binary Search Tree (BST) of N nodes is balanced if height is in O(log N) A balanced.
EECS 311: Chapter 4 Notes Chris Riesbeck EECS Northwestern.
Splay Trees CSIT 402 Data Structures II. Motivation Problems with other balanced trees – AVL: extra storage/complexity for height fields Periulous delete.
CSE 326: Data Structures Splay Trees Ben Lerner Summer 2007.
CSC 213 Lecture 7: Binary, AVL, and Splay Trees. Binary Search Trees (§ 9.1) Binary search tree (BST) is a binary tree storing key- value pairs (entries):
1 Red-Black Trees. 2 Black-Height of the tree = 4.
1 Red-Black Trees. 2 Black-Height of the tree = 4.
Trees and Red-Black Trees Gordon College Prof. Brinton.
CSE 326: Data Structures Lecture #13 Extendible Hashing and Splay Trees Alon Halevy Spring Quarter 2001.
Balanced Trees. Binary Search tree with a balance condition Why? For every node in the tree, the height of its left and right subtrees must differ by.
TCSS 342 BST v1.01 BST addElement To addElement(), we essentially do a find( ). When we reach a null pointer, we create a new node there. void addElement(Object.
1 BST Trees A binary search tree is a binary tree in which every node satisfies the following: the key of every node in the left subtree is.
Splay Trees Splay trees are binary search trees (BSTs) that:
Splay Trees and B-Trees
1 Red-Black Trees. 2 Definition: A red-black tree is a binary search tree where: –Every node is either red or black. –Each NULL pointer is considered.
Advanced Data Structures and Algorithms COSC-600 Lecture presentation-6.
Binary Search Trees. BST Properties Have all properties of binary tree Items in left subtree are smaller than items in any node Items in right subtree.
Indexing. Goals: Store large files Support multiple search keys Support efficient insert, delete, and range queries.
CSCE 3110 Data Structures & Algorithm Analysis Binary Search Trees Reading: Chap. 4 (4.3) Weiss.
Chapter 19 - basic definitions - order statistics ( findkth( ) ) - balanced binary search trees - Java implementations Binary Search Trees 1CSCI 3333 Data.
CMSC 341 Splay Trees. 8/3/2007 UMBC CMSC 341 SplayTrees 2 Problems with BSTs Because the shape of a BST is determined by the order that data is inserted,
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Red Black Tree Smt Genap Outline Red-Black Trees ◦ Motivation ◦ Definition ◦ Operation Smt Genap
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 8.
B-Trees and Red Black Trees. Binary Trees B Trees spread data all over – Fine for memory – Bad on disks.
Advanced Data Structures and Implementation Top-Down Splay Trees Top-Down Splay Trees Red-Black Trees Red-Black Trees Top-Down Red Black Trees Top-Down.
Red–black trees.  Define the red-black tree properties  Describe and implement rotations  Implement red-black tree insertion  We will skip red-black.
WEEK 3 Leftist Heaps CE222 Dr. Senem Kumova Metin CE222_Dr. Senem Kumova Metin.
Oct 26, 2001CSE 373, Autumn A Forest of Trees Binary search trees: simple. –good on average: O(log n) –bad in the worst case: O(n) AVL trees: more.
Review for Exam 1 Topics covered: –Asymptotic analysis –Lists and list implementations Stacks and queues –General trees, binary trees –BST For each of.
Review for Exam 2 Topics covered (since exam 1): –Splay Tree –K-D Trees –RB Tree –Priority Queue and Binary Heap –B-Tree For each of these data structures.
Review for Final Exam Non-cumulative, covers material since exam 2 Data structures covered: –Treaps –Hashing –Disjoint sets –Graphs For each of these data.
Binary Search Trees (BSTs) 18 February Binary Search Tree (BST) An important special kind of binary tree is the BST Each node stores some information.
Data Structures AVL Trees.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
Binary Tree. Some Terminologies Short review on binary tree Tree traversals Binary Search Tree (BST)‏ Questions.
Jim Anderson Comp 750, Fall 2009 Splay Trees - 1 Splay Trees In balanced tree schemes, explicit rules are followed to ensure balance. In splay trees, there.
Exam 3 Review Data structures covered: –Hashing and Extensible hashing –Priority queues and binary heaps –Skip lists –B-Tree –Disjoint sets For each of.
Week 7 - Wednesday.  What did we talk about last time?  Recursive running time  Master Theorem  Symbol tables.
CSC 2300 Data Structures & Algorithms March 13, 2007 Chapter 6. Priority Queues.
Splay trees Go&Ta How do you organize your world?
1 Red-Black Trees. 2 A Red-Black Tree with NULLs shown Black-Height of the tree = 4.
Definitions and Bottom-Up Insertion
AA Trees.
Red-Black Tree Neil Tang 02/07/2008
G64ADS Advanced Data Structures
Topics covered (since exam 1):
Red Black Trees
Week 6 - Wednesday CS221.
Review for Final Exam Non-cumulative, covers material since exam 2
Review for Final Exam Non-cumulative, covers material since exam 2
Tree data structure.
Review for Final Exam Non-cumulative, covers material since exam 2
Review for Exam 1 Topics covered: For each of these data structures
Topics covered (since exam 1):
Tree data structure.
Topics covered (since exam 1):
Red-Black Trees.
Topics covered (since exam 1, excluding PQ):
Binary Trees, Binary Search Trees
CSC 143 Binary Search Trees.
BST Insert To insert an element, we essentially do a find( ). When we reach a NULL pointer, we create a new node there. void BST::insert(const Comp &
Topics covered (since exam 1):
Binary Trees, Binary Search Trees
Splay Trees Binary search trees.
Presentation transcript:

Review for Exam 2 Topics covered: –Recursion and recursive functions –General rooted trees –Binary Search Trees (BST) –Splay Tree –RB Tree –K-D Trees For each of these data structures –Basic idea of data structure and operations –Be able to work out small example problems –Prove related theorems –Asymptotic time performance –Advantages and limitations –comparison

Review for Exam 2 Recursion –Recurrence relation, recursive definition and recursive function Base case(s) Recursion part –Related to induction and problem reduction Linear recursion, tree recursion and tail recursion Good and bad things about recursive function (vs. iterative function) Be able to write recursive functions (in pseudo code and C++)

Review for Exam 2 General rooted tree –Definition –Height and depth, path length –Binary and K-ary tree and their nodes Binary trees –Full, complete and perfect binary trees –Internal and external nodes, IPL, EPL –4 different orders of tree traversals

Review for Exam 2 BST –Definition –Basic operations and their implementations find, findMin, findMax insert, remove, makeEmpty –Time performance of these operations –Problems with unbalanced BST (degeneration)

Review for Exam 2 Splay tree –Definition (a special BST: balanced in some sense) –Rationale for splaying (data locality) –Splay operation Root without grandparent with grandparent: zig-zag and zig-zig –When to splay (after each operation) –What to splay with find/insert/delete operations –Amortized time performance analysis: what does O(m log n) mean?

Review for Exam 2 RB tree –Definition: a BST satisfying 5 conditions Every node is either red or black. Root is black Each NULL pointer is considered to be a black node If a node is red, then both of its children are black. Every path from a node to a NULL contains the same number of black nodes. –Theorems leading to O(log n) worst case time performance Black height min and max # of nodes a RB tree with bh=k can have –Bottom-up insertion and deletion, top-down insertion –Why top down?

K-D Trees –What K-D trees are used for Multiple keys –How K-D tree differs from the ordinary BST levels –Be able to do insert and range query/print Review for Exam 2