Red Black Tree Prof. Keshav Tambre Assistant Professor Department of Information Technology Hope Foundation’s International Institute of Information Technology,

Slides:



Advertisements
Similar presentations
Chapter 13. Red-Black Trees
Advertisements

BST Search To find a value in a BST search from the root node: If the target is less than the value in the node search its left subtree If the target is.
CMPT 225 Red–black trees. Red-black Tree Structure A red-black tree is a BST! Each node in a red-black tree has an extra color field which is red or black.
Red–black trees.  Define the red-black tree properties  Describe and implement rotations  Implement red-black tree insertion  Implement red-black.
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.
Insertion Example Insert Insertion Example Insert
Red-Black Trees CIS 606 Spring Red-black trees A variation of binary search trees. Balanced: height is O(lg n), where n is the number of nodes.
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
Lecture 12: Balanced Binary Search Trees Shang-Hua Teng.
1 Red-Black Trees. 2 Black-Height of the tree = 4.
CS2420: Lecture 31 Vladimir Kulyukin Computer Science Department Utah State University.
1 /26 Red-black tree properties Every node in a red-black tree is either black or red Every null leaf is black No path from a leaf to a root can have two.
David Luebke 1 7/2/2015 ITCS 6114 Red-Black Trees.
Deletion algorithm – Phase 2: Remove node or replace its with successor TreeNode deleteNode(TreeNode n) { // Returns a reference to a node which replaced.
Analysis of Red-Black Tree Because of the rules of the Red-Black tree, its height is at most 2log(N + 1). Meaning that it is a balanced tree Time Analysis:
10/20/2015 2:03 PMRed-Black Trees v z. 10/20/2015 2:03 PMRed-Black Trees2 Outline and Reading From (2,4) trees to red-black trees (§9.5) Red-black.
Introduction to Algorithms Jiafen Liu Sept
© 2004 Goodrich, Tamassia Red-Black Trees v z.
CSIT 402 Data Structures II
Data Structures Balanced Trees 1CSCI Outline  Balanced Search Trees 2-3 Trees Trees Red-Black Trees 2CSCI 3110.
Lecture 10 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Lecture 2 Red-Black Trees. 8/3/2007 UMBC CSMC 341 Red-Black-Trees-1 2 Red-Black Trees Definition: A red-black tree is a binary search tree in which: 
Red–black trees.  Define the red-black tree properties  Describe and implement rotations  Implement red-black tree insertion  We will skip red-black.
Red-Black Trees Definitions and Bottom-Up Insertion.
Red Black Trees Top-Down Deletion. Recall the rules for BST deletion 1.If vertex to be deleted is a leaf, just delete it. 2.If vertex to be deleted has.
1 Binary Search Trees  Average case and worst case Big O for –insertion –deletion –access  Balance is important. Unbalanced trees give worse than log.
Red-Black Trees Bottom-Up Deletion. Recall “ordinary” BST Delete 1.If vertex to be deleted is a leaf, just delete it. 2.If vertex to be deleted has just.
Red-Black Trees an 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.
AA Trees.
File Organization and Processing Week 3
Red-Black Trees v z Red-Black Trees Red-Black Trees
Red-Black 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.
Red-Black Trees 5/22/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and.
CS 332: Algorithms Red-Black Trees David Luebke /20/2018.
Red Black Trees
Lecture 17 Red-Black Trees
CSCI Trees and Red/Black Trees
CO4301 – Advanced Games Development Week 10 Red-Black Trees continued
Red-Black Trees v z Red-Black Trees 1 Red-Black Trees
Red-Black Trees Bottom-Up Deletion.
Red-Black Trees Bottom-Up Deletion.
Red-Black Trees Motivations
Monday, April 16, 2018 Announcements… For Today…
Data Structures Balanced Trees CSCI
Red-Black Trees Bottom-Up Deletion.
TCSS 342, Winter 2006 Lecture Notes
Red-Black Trees v z Red-Black Trees 1 Red-Black Trees
Red-Black Trees v z /20/2018 7:59 AM Red-Black Trees
Red-Black Trees v z Red-Black Trees Red-Black Trees
Lecture 9 Algorithm Analysis
Red-Black Trees Bottom-Up Deletion.
Lecture 9 Algorithm Analysis
Lecture 9 Algorithm Analysis
Red Black Trees Top-Down Deletion.
Red-Black Trees v z /17/2019 4:20 PM Red-Black Trees
Red-Black Trees Bottom-Up Deletion.
Composition & Resolution of Forces
Red-Black Trees.
Differential Equation
Red-Black Trees Bottom-Up Deletion.
BINARY HEAP Prof ajitkumar shitole Assistant Professor Department of computer engineering Hope Foundation’s International Institute of Information.
(2,4) Trees /6/ :26 AM (2,4) Trees (2,4) Trees
Hope Foundation’s International Institute of Information.
Design procedure for an Integrator
Analysis of Algorithms CS 477/677
Algorithms CSCI 235, Spring 2019 Lecture 24 Red Black Trees II
Algorithms, CSCI 235, Spring 2019 Lecture 22—Red Black Trees
Announcements Midterm will be given on 10/21/99
Red Black Trees Top-Down Deletion.
Red-Black Trees v z /6/ :10 PM Red-Black Trees
Presentation transcript:

Red Black Tree Prof. Keshav Tambre Assistant Professor Department of Information Technology Hope Foundation’s International Institute of Information Technology, I²IT www.isquareit.edu.in

Insertion Example Insert 65 47 32 71 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 47 32 71 65 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 32 71 65 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 32 71 65 93 82 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 32 71 71 65 65 93 93 change nodes’ colors 82 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 Insert 87 32 71 65 93 82 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 Insert 87 32 71 65 93 82 87 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 Insert 87 32 71 65 93 82 87 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 Insert 87 32 71 65 93 87 82 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example 47 Insert 65 Insert 82 32 71 Insert 87 65 93 93 change nodes’ colors 87 87 82 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Insertion Example Insert 65 Insert 82 47 Insert 87 32 71 65 87 82 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Left Rotation: Modified algorithm TreeNode<T> leftRotate(TreeNode<T> root,TreeNode<T> x) //returns a new root; Pre: right child of x is a proper node (with value) { TreeNode<T> z = x.getRight(); x.setRight(z.getLeft()); // Set parent reference if (z.getLeft() != null) z.getLeft().setParent(x); z.setLeft(x); //move x down z.setParent(x.getParent()); // Set parent reference of x if (x.getParent() != null) //x is not the root if (x == x.getParent().getLeft()) //left child x.getParent().setLeft(z); else x.getParent().setRight(z); root=z; x.setParent(z); return root; } Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

RB Tree: Insertion Algorithm TreeNode<T> rbInsert(TreeNode<T> root,TreeNode<T> x) // returns a new root { root=bstInsert(root,x); // a modification of BST insertItem x.setColor(red); while (x != root and x.getParent().getColor() == red) { if (x.getParent() == x.getParent().getParent().getLeft()) { //parent is left child y = x.getParent().getParent().getRight() //uncle of x if (y.getColor() == red) {// uncle is red x.getParent().setColor(black); y.setColor(black); x.getParent().getParent().setColor(red); x = x.getParent().getParent(); } else { // uncle is black // ................ } } else // ... symmetric to if } // end while root.setColor(black); return root; bstInsert was taking T and created a new node, here we assume that a new node was already created and it’s passed as a second parameted to bstInsert Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

RB Tree: Insertion Algorithm TreeNode<T> rbInsert(TreeNode<T> root,TreeNode<T> newNode) // returns a new root { root=bstInsert(root,newNode); // a modification of BST insertItem x.setColor(red); while (x != root and x.getParent().getColor() == red) { if (x.getParent() == x.getParent().getParent().getLeft()) { //parent is left y = x.getParent().getParent().getRight() //uncle of x if (y.getColor() == red) {// uncle is red // ................ } else { // uncle is black if (x == x.getParent().getRight()) { x = x.getParent(); root = left_rotate(root,x); } x.getParent().setColor(black); x.getParent().getParent().setColor(red); root = right_rotate(root,x.getParent().getParent()); } else // ... symmetric to if } // end while root.setColor(black); return root; Question: what is the time cost of Insertion algorithm? Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Red-black Tree Deletion First use the standard BST tree deletion algorithm If the node to be deleted is replaced by its successor/predecessor (if it has two non-null children), consider the deleted node’s data as being replaced by it’s successor/predecessor's, and its color remaining the same The successor/predecessor node is then removed Let y be the node to be removed If the removed node was red, no property could get violated, so just remove it. Otherwise, remove it and call the tree-fix algorithm on y’s child x (the node which replaced the position of y) Remember, the removed node can have at most one real (non-null) child If it has one real child, call the tree-fix algorithm on it If it has no real children (both children are null), Note that this child may be a (black) pretend (null) child Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Fixing a red-black Tree The tree-fix algorithm considers the parameter (x) as having an “extra” black token This corrects the violation of property 4 caused by removing a black node If x is red, just color it black But if x is black then it becomes “doubly black” This is a violation of property 1 The extra black token is pushed up the tree until a red node is reached, when it is made black the root node is reached or it can be removed by rotating and recoloring Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 1 Delete 87 47 32 71 65 87 82 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 1 Delete 87 47 32 71 65 82 87 Replace data with predecessor Predecessor red: no violation 82 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 2 Delete 71 47 32 71 65 87 51 82 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 2 Delete 71 47 32 65 71 65 87 Replace with predecessor Attach predecessor’s child 51 82 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 2 Delete 71 47 32 65 87 Replace with predecessor Attach predecessor’s child 51 51 82 93 Fix tree by coloring predecessor’s child black Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 3 Delete 32 47 32 71 65 87 82 93 Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 3 Delete 32 47 32 71 x x 65 87 Identify x – the removed node’s left child Remove target node 82 93 Attach x to parent of target Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 3 Delete 32 47 71 x 65 87 Identify x – the removed node’s left child Remove target node 82 93 Attach x to parent of target Call rbTreeFix on x Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

RB Tree Deletion Algorithm TreeNode<T> rbDelete(TreeNode<T> root,TreeNode<T> z) //return new root, z contains item to be deleted { TreeNode<T> x,y; // find node y, which is going to be removed if (z.getLeft() == null || z.getRight() == null) y = z; else { y = successor(z); // or predecessor z.setItem(y.getItem); // move data from y to z } // find child x of y if (y.getRight() != null) x = y.getRight(); else x = y.getLeft(); // Note x might be null; create a pretend node if (x == null) { x = new TreeNode<T>(null); x.setColor(black); Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

RB Tree Deletion Algorithm x.setParent(y.getParent()); // detach x from y if (y.getParent() == null) // if y was the root, x is a new root root = x; else // Atttach x to y’s parent if (y == y.getParent().getLeft()) // left child y.getParent().setLeft(x); y.getParent().setRight(x); if (y.getColor() == black) root=rbTreeFix(root,x); if (x.getItem() == null) // x is a pretend node if (x==x.getParent().getLeft()) x.getParent().setLeft(null); x.getParent().setRight(null); return root; } Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 3 (continued) 47 47 After deleting 32, x is a node with black token y 71 71 x 65 87 Identify y, x’s sibling Make y black and y’s parent red x’s sibling is red 82 93 Left rotate x’s parent Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 3 After deleting 32, x is a node with black token y 71 47 87 x new y 65 82 93 Identify y, x’s sibling Make y black and y’s parent red Left rotate x’s parent Identify y – x’s new sibling Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Deletion Example 3 After deleting 32, x is a node with black token 71 new x 47 47 87 x y 65 65 82 93 Identify y, x’s sibling Make y black and y’s parent red x’s sibling is black Left rotate x’s parent Identify y – x’s new sibling Color y red Assign x it’s parent, and color it black Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Tree Fix algorithm cases: case (1) x is red The simplest case x has a black token and is colored red, so just color it black and remove token a we are done! In the remaining cases, assume x is black (and has the black token, i.e., it’s double black) Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Tree Fix algorithm cases: case (2) x’s sibling is red Left_rotate(y) Right_rotate(y) Colors of y and z were swapped Colors of x and y Remark: it might seem that black token is going down, so the algorithm will never end (or takes more then O(height) time), but in the next it will finish, so it doesn’t matter we go one level down with black token In symmetric cases, x is called z. Remarks: the roots of subtrees C and D are black the second is the symmetric case, when x is the right child in the next step (case (3) or (4)) the algorithm will finish! Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Tree Fix algorithm cases: case (3) x’s sibling is black and both nephews are black Remarks: nephews are roots of subtrees C and D the black token is passed one level up Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Tree Fix algorithm cases: case (4) x’s sibling is black and at least one nephew is red Right_rotate(w) Left_rotate(y) Colors of y and z were swapped. Far nephew is colored black and black token is removed. Colors of z and w were swapped Right_rotate(z) Left_rotate(x) Colors of z and y were swapped. Far nephew is colored black and black token is removed. Colors of x and y were swapped Remarks: in this case, the black token is removed completely if the “far” nephew is black (subcase (i)), rotate its parent, so that a new “far” nephew is red; otherwise start in subcase(ii) Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Tree Fix Algorithm TreeNode<T> rbTreeFix(TreeNode<T> root,TreeNode<T> x) //return new root; x is a node with the black token { while (x != root && x.getColor() == black) // not case (1) if (x == x.getParent().getLeft()) { // x is left child y = x.getParent().getRight(); // y is x’s sibling if (y.getColor() == red) { // case (2) y.setColor(black); x.getParent().setColor(red); // p was black root = left_rotate(root,x.getParent()); y = x.getParent().getRight(); // new sibling } if (y.getLeft().getColor() == black && y.getRight().getColor() == black) { // nephews are black - case (3) y.setColor(red); x = x.getParent(); } else { // case (4) // .......... } else { … // x is right child - symmetric // end while loop x.setColor(black); return root; Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

Tree Fix Algorithm (continued) } else { // case (4) if (y.getRight().getColor() == black) { // subcase (i) y.getLeft().setColor(black); y.setColor(red); root = right_rotate(root,y); y = x.getParent().getRight(); } // subcase (ii) y.setColor(x.getParent().getColor()); x.getParent().setColor(black); y.getRight().setColor(black); root = left_rotate(root, x.getParent()); x = root; // we can finish Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

RB Trees efficiency Sorted List Search Insertion Deletion with arrays All operations work in time O(height) and we have proved that heigh is O(log n) hence, all operations work in time O(log n)! – much more efficient than linked list or arrays implementation of sorted list! Sorted List Search Insertion Deletion with arrays O(log n) O(n) with linked list with RB trees Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 | www.isquareit.edu.in | info@isquareit.edu.in

THANK YOU For further details, please contact Keshav Tambre keshavt@isquareit.edu.in Department of Information Technology Hope Foundation’s International Institute of Information Technology, I²IT P-14,Rajiv Gandhi Infotech Park MIDC Phase 1, Hinjawadi, Pune – 411057 Tel - +91 20 22933441/2/3 www.isquareit.edu.in | info@isquareit.edu.in