15 views

Uploaded by Sunil Kumar

AVL B Tree Treap Splay

AVL B Tree Treap Splay

© All Rights Reserved

- Planning TASK
- 4.MCM Syllabus
- indexing structures for files
- PeopleSoft HR PeopleBook
- B
- Lecture 2-Hypermesh
- CS482 Data Structures
- Data Structures
- avl-tree
- data stuture record.doc
- L02-4up
- Fundamentals of Overcurrent Protection
- lect5
- HLTV Readme
- Data Structures -CS1211
- Efficient Spatial Database Keyword Search
- Auto Agent Commission calculation Using BST
- Les19
- 9.Influence Diagrams
- Algorithm to Become a Good Programmer by Ashish Kedia

You are on page 1of 17

Definition:

binary search tree

For any node, the heights of left subtree and

right subtree differ at most 1.

(if differ at most k, called BH(k) tree).

The height of an AVL tree with N internal

nodes always lies between log (N +1 ) and

1..4404 log(N + 2) - 0.328

http://www.eli.sdsu.edu/courses/fall96/cs660/notes/avl/avl.html#RTFToC2

AVL Tree

Insertion:

As normal binary search tree insertion

Reconstruct tree by rotation if some nodes become unbalanced

Deletion:

as normal binary search tree deletion

The node deleted will be either a leaf or have just one subtree (this is true for all

binary search tree deletion)

if the deleted node has one subtree, then that subtree contains only one node

Traverse up the tree from the deleted node checking the balance of each node,

balance the node by rotation if unbalanced

Theorem:

An insertion into an AVL tree requires at most one rotation to rebalance a tree. A

deletion may require log(N) rotations to rebalance the tree.

Insert into subtree 3

Perform double rotation

Deletion from subtree 1

B-Tree

Similar to Red-Black tree or others, balanced search

tree

Different from other balanced search tree, nodes

may have many children. So mainly used for Disk

I/O.

A node x with n[x] keys

the keys in x are stored in non-decreasing order,

the keys in children are delimited by the keys

all paths from the root to a leaf are of equal length, i.e. height-balanced

An example of B Tree

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

B-tree of degree t

Definition:

Root must have 1 key

Internal node has at least t-1 keys but at most

2t-1 keys, i.e. has at least t but at most 2t

children.

Theorem: hlogt(n+1)/2

Insertion and deletions:

More complicate but still log (n)

Split and merge operation.

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

2-3-4 Tree

A B-tree of degree t=2.

So every node has 2,3,4 children.

Recursive definition

nil is a 2-3-4 tree,

a leaf is a 2-3-4 tree,

an internal node has either 2, 3 or 4 children,

all paths from the root to a leaf are of equal length i.e. a 2-3-4-tree is

height-balanced

Height log(n) in balance search tree of n nodes

Binary tree or non-binary, such as B-tree

Whether all n nodes are placed as leaves or also as internal nodes.

B+-Tree:

real application data nodes are leaves, internal nodes are keys through

which the search can be traced to real data.

Treap

Consider as Tree + Heap

-organize the tree as binary search tree by keys

Assign random chosen priorities to nodes, adjust the tree to obey minheap order property

i.e. Assume that all keys are distinct, so do priorities, for any node u,

if v is a left child of u, key[v]<key[u]

if v is a right child of u, key[v]>key[u]

If v is a child of u, priority[v]>priority[u]

so are insertion and deletion.

Splay tree

(See the end of amortized analysis)

Height may be larger than log n, even n-1.

However a sequence of n operations takes O(nlog n).

Assumptions: data values are distinct and form a totally

order set

Operations:

Member(i,S)

Insert(i,S)

Delete(i,S)

Merge(S,S)

Split(i,S)

All based on

splay(i,S), reorganize tree so that i to be root if iS, otherwise, the

new root is either max{k S |k<i} or min{k S |k>i}

For examples,

merge(S,S)

Call Splay(, S) and then make S the right child

merge(left(i), right(i)).

Similar for others.

Constant number of splays called.

Splay operation is based on basic rotate(x)

operation (either left or right).

Three cases:

y is the parent of x and x has no grandparent

rotate(x)

(or right) child of z,

rotate(y) and then rotate(x)\

right (or left) child of z,

rotate(x) and then rotate(x)

Credit invariant: Node x always has at

least log (x) credits on deposit.

Where (S)=log (|S|) and (x)=(S(x))

Lemma:

Each operation splay(x,S) requires no more

than 3((S)-(x))+1 credits to perform the

operation and maintain the credit invariant.

Theorem:

A sequence of m operations involving n inserts

takes time O(mlog(n)).

- Planning TASKUploaded bysenthur123
- 4.MCM SyllabusUploaded byYogesh Patil
- indexing structures for filesUploaded byMena Sameh
- PeopleSoft HR PeopleBookUploaded bypeterlasking
- Lecture 2-HypermeshUploaded bykashish4u
- BUploaded byChippyVijayan
- CS482 Data StructuresUploaded byhaseena
- Data StructuresUploaded bysumanta_76394
- avl-treeUploaded bykarunakarkavuri
- data stuture record.docUploaded byHemanth Kumar Rajendakumar
- L02-4upUploaded byPopa Flavius
- Fundamentals of Overcurrent ProtectionUploaded byhalel111
- lect5Uploaded bythewodros
- HLTV ReadmeUploaded byJose Karym Zavaleta Silva
- Data Structures -CS1211Uploaded bySunil Sodegaonkar
- Efficient Spatial Database Keyword SearchUploaded byAnonymous vQrJlEN
- Auto Agent Commission calculation Using BSTUploaded byEditor IJRITCC
- Les19Uploaded byRajesh Kumar
- 9.Influence DiagramsUploaded byNeslihan Ak
- Algorithm to Become a Good Programmer by Ashish KediaUploaded byArka Prava Paul
- 4.01.TreesUploaded byDr.BILAL WAJID
- schnyderUploaded byFidelinux
- 50620130101006Uploaded byIAEME Publication
- DS VivaUploaded bydonotandrew
- phylogeny_15Jan2007Uploaded byMukul Bhalla
- 12 Graphs Post3upUploaded byIbad Mohammed
- Lecture 15Uploaded bySunil
- Fibonacci heapsUploaded bymanishbhardwaj8131
- yield-ppUploaded bynnnniccjjj
- Classification Algorithms and Regression Trees.pdfUploaded byVenkatraman Krishnamoorthy

- Synopsis of hotel management systemUploaded bygupta_archi
- SynopsisUploaded bySunil Kumar
- Stored Procedures for Java Programmers - O'Reilly Media.pdfUploaded bySunil Kumar
- MCSP-060 Project guide linesUploaded bynayanthara_r
- Stored Procedures for Java Programmers - O'Reilly MediaUploaded bySunil Kumar
- Academic Programmes IGNOUUploaded byElizMasters
- GitHub GuidesUploaded bySunil Kumar
- Ooad TutorialUploaded bySunil Kumar
- List of Unix CommandsUploaded bySunil Kumar
- Kruskals PrimsUploaded bySunil Kumar
- READ MEUploaded bySunil Kumar
- Instruction SetUploaded bySunil Kumar
- About 8086Uploaded bySunil Kumar
- sem_b_MT2Uploaded bySunil Kumar
- JokesUploaded bySunil Kumar

- Data Structures.docxUploaded byRitesh Singh
- Data Structures Lab ManualUploaded byDragu Stelian
- al gorithms.pdfUploaded byEssam Kaoud
- MI0034 SET-1 & SET-2Uploaded bysantosh143hsv143
- New Text DocugfdgfgregUploaded byDana Gabriela
- File System ManagementUploaded bymanishbhardwaj8131
- IJCSE11-03-07-092Uploaded byd4nief
- Advanced Data Structures and ImplementationUploaded byLab Bhattacharjee
- SQL Server Latch ContentionUploaded bysaara2banana
- DBMS CheatsheetUploaded bydevendraiiit1
- Cf CollectionsUploaded bySworna Vidhya
- Oracle vs Sybase.pdfUploaded byinfombm
- Decoupling Markov Models from Neural Networks in the Producer - Consumer ProblemUploaded byJoseAnderson
- 147301-NOLUploaded byhi_am_balaji
- EE2204 DSA 100 2marksUploaded byVinod Deenathayalan
- Spatial Data StructuresUploaded bydevasis
- CS301 Midterm Papers Collection Shared by Sweet SoulUploaded byAamir Amin
- B+ TreesUploaded bymanishbhardwaj8131
- Lsm TreeUploaded byathenss
- Top 10 Tips for Oracle Database Performance-Part 1Uploaded bydommarajuuu1
- It33- Data Structures and AlgorithmsUploaded byMathan Nagan
- Web for Database Management Systems BCA 4th SemUploaded byPrakashRead2010
- Discovery of Stock Trading Expertise Using Genetic ProgrammingUploaded byAli Jafri Chicago Booth MBA
- 5-fileUploaded byPalashAhuja
- sqlite-formatextensionUploaded bycrazydman
- Cs301 02 Mid Spring 20101 My Comp Let FileUploaded bySobia_Zaheer_2252
- JUNE 2012 UGC NET COMPUTER SCIENCE- SOLVEDUploaded byvani_ppc
- 5. DSA - TreesUploaded byDebabala Swain
- L04-X-B-TreesUploaded byuytru
- Column Oriented DatabaseUploaded bySoumyaMishra