A Study of Balanced Search Trees: Brainstorming a New Balanced Search Tree Anthony Kim, 2005 Computer Systems Research.

Slides:



Advertisements
Similar presentations
Transform and Conquer Chapter 6. Transform and Conquer Solve problem by transforming into: a more convenient instance of the same problem (instance simplification)
Advertisements

AVL Trees COL 106 Amit Kumar Shweta Agrawal Slide Courtesy : Douglas Wilhelm Harder, MMath, UWaterloo
Binary Trees, Binary Search Trees CMPS 2133 Spring 2008.
CS202 - Fundamental Structures of Computer Science II
Binary Trees, Binary Search Trees COMP171 Fall 2006.
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.
Balanced Binary Search Trees
CS 171: Introduction to Computer Science II
A balanced life is a prefect life.
Advanced Tree Data Structures Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Balanced Search Trees  several varieties  AVL trees  trees  Red-Black trees  B-Trees (used for searching secondary memory)  nodes are added.
Chapter 6: Transform and Conquer Trees, Red-Black Trees The Design and Analysis of Algorithms.
4a-Searching-More1 More Searching Dan Barrish-Flood.
1 Theory I Algorithm Design and Analysis (3 - Balanced trees, AVL trees) Prof. Th. Ottmann.
1 Binary Search Trees Implementing Balancing Operations –AVL Trees –Red/Black Trees Reading:
1 Red-Black Trees. 2 Black-Height of the tree = 4.
Department of Computer Eng. & IT Amirkabir University of Technology (Tehran Polytechnic) Data Structures Lecturer: Abbas Sarraf Search.
Self-Balancing Search Trees Chapter 11. Chapter 11: Self-Balancing Search Trees2 Chapter Objectives To understand the impact that balance has on the performance.
B + -Trees (Part 1) Lecture 20 COMP171 Fall 2006.
B + -Trees (Part 1). Motivation AVL tree with N nodes is an excellent data structure for searching, indexing, etc. –The Big-Oh analysis shows most operations.
Self-Balancing Search Trees Chapter 11. Chapter Objectives  To understand the impact that balance has on the performance of binary search trees  To.
B + -Trees (Part 1) COMP171. Slide 2 Main and secondary memories  Secondary storage device is much, much slower than the main RAM  Pages and blocks.
General Trees and Variants CPSC 335. General Trees and transformation to binary trees B-tree variants: B*, B+, prefix B+ 2-4, Horizontal-vertical, Red-black.
B + -Trees COMP171 Fall AVL Trees / Slide 2 Dictionary for Secondary storage * The AVL tree is an excellent dictionary structure when the entire.
Balanced Trees Balanced trees have height O(lg n).
1 B-Trees Section AVL (Adelson-Velskii and Landis) Trees AVL tree is binary search tree with balance condition –To ensure depth of the tree is.
Quantifying the dynamics of Binary Search Trees under combined insertions and deletions BACKGROUND The complexity of many operations on Binary Search Trees.
AVL Trees Neil Ghani University of Strathclyde. General Trees Recall a tree is * A leaf storing an integer * A node storing a left subtree, an integer.
Trevor Brown – University of Toronto B-slack trees: Space efficient B-trees.
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Course: Programming II - Abstract Data Types Red-Black TreesSlide Number 1 Balanced Search Trees Binary Search Tree data structures can allow insertion,
Red-Black Trees Red-black trees: –Binary search trees augmented with node color –Operations designed to guarantee that the height h = O(lg n)
Computer Algorithms Submitted by: Rishi Jethwa Suvarna Angal.
© 2006 Pearson Addison-Wesley. All rights reserved13 B-1 Chapter 13 (continued) Advanced Implementation of Tables.
CSIT 402 Data Structures II
Beyond (2,4) Trees What do we know about (2,4)Trees? Balanced
Red-Black Trees Acknowledgment Many thanks to “erm” from Purdue University for this very interesting way of presenting this course material. 1.
Chapter 13 B Advanced Implementations of Tables – Balanced BSTs.
Balanced Search Trees Fundamental Data Structures and Algorithms Margaret Reid-Miller 3 February 2005.
1 Red-Black Trees By Mary Hudachek-Buswell Red Black Tree Properties Rotate Red Black Trees Insertion Red Black Trees.
1 Balanced Trees There are several ways to define balance Examples: –Force the subtrees of each node to have almost equal heights –Place upper and lower.
2IL50 Data Structures Fall 2015 Lecture 7: Binary Search Trees.
Starting at Binary Trees
1 Trees 4: AVL Trees Section 4.4. Motivation When building a binary search tree, what type of trees would we like? Example: 3, 5, 8, 20, 18, 13, 22 2.
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.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 9.
Lecture 11COMPSCI.220.FS.T Balancing an AVLTree Two mirror-symmetric pairs of cases to rebalance the tree if after the insertion of a new key to.
D. ChristozovCOS 221 Intro to CS II AVL Trees 1 AVL Trees: Balanced BST Binary Search Trees Performance Height Balanced Trees Rotation AVL: insert, delete.
CIS 068 Welcome to CIS 068 ! Lesson 12: Data Structures 3 Trees.
B-Trees Katherine Gurdziel 252a-ba. Outline What are b-trees? How does the algorithm work? –Insertion –Deletion Complexity What are b-trees used for?
CSCE 210 Data Structures and Algorithms
AA Trees.
Red-Black Tree Neil Tang 02/07/2008
Red-Black Tree Neil Tang 02/04/2010
G64ADS Advanced Data Structures
Data Structures – LECTURE Balanced trees
Red Black Trees
CS202 - Fundamental Structures of Computer Science II
CS202 - Fundamental Structures of Computer Science II
CSCI Trees and Red/Black Trees
Tree.
Binary Trees, Binary Search Trees
Red-Black Trees Motivations
CS202 - Fundamental Structures of Computer Science II
Advanced Implementation of Tables
Binary Trees, Binary Search Trees
CS202 - Fundamental Structures of Computer Science II
Binary Trees, Binary Search Trees
CS202 - Fundamental Structures of Computer Science II
CS202 - Fundamental Structures of Computer Science II
Presentation transcript:

A Study of Balanced Search Trees: Brainstorming a New Balanced Search Tree Anthony Kim, 2005 Computer Systems Research

Abstract This project investigates three different balanced search trees for their advantages and disadvantages, thus ultimately their efficiency. Run time and memory space management are two main aspects under the study. Statistical analysis is provided to distinguish subtle differences if there is any. A new balanced search tree is suggested and compared with the four balanced search trees under study,. Balanced search trees are implemented in C++ extensively using pointers and structs.

Introduction ● A simple binary search tree has some disadvantages, specifically from its dependence on the incoming data, that significantly affects its tree structure hence its performance. (Ex. linear tree) ● An optimal search tree is one that tries to minimize its height given some data. (Ex. Red-black tree has 2lg(n+1) height max) ● Some of balanced search trees are red-black tree, AVL tree, weight-balanced tree, and B tree.

Background ● Simple vocabs: nodes, edges, children, parent, root ● Printing tree using recursion: pre-, in-, and post- order traversal ● Basic binary search tree functions: insertion, lookup, deletion (only first two apply in this project) ● Rotating functions: the key player in balancing (Left rotation and right rotation.)

Some Balanced Search (Red-black tree) ● Four properties ● The root of the tree is colored black. ● All paths from the root to the leaves agree on the number of black nodes. ● No path from the root to a leaf may contatin two consecutive nodes colored red. ● Every path from a node to a leaf (of the descendants) has the same number of black nodes ● Has height at most 2lg(n+1)

Some Balanced Search Tree (Weight & height balanced search tree.) ● Weight balanced tree and height balanced tree are very similar. ● Weight balanced tree (Height balanced tree) has one property ● At each node, the difference between weight(height) of left subtree and weight(height) of right subtree is less than the threshold value. ● Supposedly yield height lg(n) at most

A New Balanced Search Tree Median-weight-mix tree ● Assumption on statistical data ● Give lower bound and upper bound of total data input, random behavior is assumed, meaning data points will be evenly distributed throughout the interval ● Multiple “crests” is assumed to be present in the interval. ● Each node will have a key (data number), an interval (with lower and upper bounds of its assigned interval) and weights of left subtree and right subtree.

A New Balanced Search Tree Median-weight-mix tree ● Algorithm ● The weights of each subtree are calculated based on constants R and S ● R = the importance of focusing frequency heavy data points ● S = the importance of focusing frequency weak data points ● Left/right rotations to balanced R to S ratio

Testing Methodology ● 14 Randomly generated test cases (test case size ranges 20 – 10,000) ● 4 Real test scores of math competition etc. ● Things I am looking for – Total Run Time – Average Time Retrieval – Height of Tree – Average Retrieval Depth

Test Runs (Height-balanced Tree)

Results Total Run Time Test CaseRedblackHeightWeightMWM N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A Average retrieval time Test CaseRedblackHeightWeightMWM N/A N/A N/A N/A000 10N/A N/A N/A N/A N/A N/A N/A

Results Depth Test CaseRedblackHeightWeightMWM N/A810 4N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A1642N/A Average Retrieval Depth Test CaseRedblackHeightWeightMWM N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A

Result ● Total run time and average retrieval time data did not make any sense. ● Hard to time processes on fast computers ● Red-black tree segmentation faulted for large test cases >500, so it provided no experimental data

Result (Height)

Result (Average retrieval depth)

Analysis ● All balanced search trees show logarithmic characteristics for height and average retrieval depth as expected. (except red-black tree) ● Height-balanced tree seems to perform the best among three working balanced search trees. ● Median-weight-mix tree’s logarithmic line lies between height-balanced tree’s line and weight- balanced tree’s line.

Conclusion ● The project experimentally showed that balanced binary search trees show logarithmic characteristics. ● Median-weight-mix tree’s performance is an intermediate between height-balanced tree’s and weight-balanced tree’s. ● More studies should be done on other balanced search trees or variants of search trees studied in this project