Sunteți pe pagina 1din 30

7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics

 Search   Sign In Join

RELATED TITLES
850 views 2 0

Size Balanced Tree: Chen Qifeng


(Farmer John) Zhongshan 
Memorial Middle School,
Guangdong, China December 29,
2006 BFS and DFS Weight Balanced CS225 - Midterm 2
Original Title: 10 陈启峰《Size Balanced Tree》 Binary Tree Run-Times -…

Uploaded by yizer

陈启峰的平衡树论⽂ Full description


   
Save Embed Share Print

Download 1 of 18   Search document 


 

Size Balanced Tree

Chen Qifeng (Farmer John)

Zhongshan Memorial Middle School, Guangdong, C

Email:344368722@QQ.com

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 1/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
December 29, 2006
Related
 titles Search   Sign In Join

Abstract
This paper presents a unique strategy for maintaining
dynamically changing Binary Search Trees that has optimal expected
worst. Size Balanced Tree is, as the name suggests, a Binary Search
BST) kept balanced by size. It is simple, efficient and versatile in eve
BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…
is very easy to implement and has a straightforward descrip
surprisingly simple proof of correctness and runtime. Its runtime ma
the fastest BST known so far. Furthermore, it works much faster
other famous BSTs due to the tendency of a perfect BST in practice
not only typical primary operations but also Select and Rank.

Key Words And Phrases


Size Balanced Tree
SBT
Maintain

This paper is dedicated to the memory of  Heaven

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 2/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join
Trusted by over 1 million members

Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions!

Start Free Trial

Cancel Anytime.

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

1 Introduction
Before presenting Size Balanced Trees it is necessary to explicate B
Trees and rotations on BSTs, Left-Rotate and Right-Rotate. 

1.1 Binary Search Tree

Binary Search Tree is a significant kind of advanced data structures.


many dynamic-set operations, including Search, Minimum, Maximum, P
Successor, Insert and Delete. It can be used both as a dictionary and as a p
queue.
A BST is an organized binary tree. Every node in a BST contains tw
most. The keys for compare in a BST are always stored in such a way as
 binary-search-tree property:
Let x be a node in a binary search tree. Then the key of x is not l

that For
in left subtree
every node tand
we not larger
use the than
fields of that
left[t]inand
right subtree.
right[t] to store two p
children. And we define key[t] to mean the value of the node t for
addition we add s[t], the size of subtree rooted at t, to keep the number of
that tree. Particularly we call 0 the pointer to an empty tree and s[0]=0.

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 3/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles 1.2 Rotations
Search   Sign In Join

In order to keep a BST balanced (not degenerated to be a chain) we u


change the pointer structure through rotations to change the configuration
local operation in a search tree that preserves the binary-search-tree prop

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

Figure1.1: The operation Left-Rotate( x) transforms the configuratio


nodes on the right into the configuration on the left by
constant number of pointers. The configuration on the
transformed into the configuration on the right by
operation, Right-Rotate(y).

1.2.1 Pseudocode Of Right-Rotate

The Right-Rotate assumes that the left child exists.

Right-Rotate (t)
1  k  left[t]

https://www.scribd.com/document/3072015/10-陈启峰-Size-Balanced-Tree
2 left[t] right[k]

4/30
7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
2  left[t] right[k]

Related
 titles 3  right[k]
Search t←
  Sign In Join
4  s[k] s[t]

5  s[t] s[left[t]]+s[right[t]]+1

6  t k  

1.2.2 Pseudocode Of Left-Rotate


The Left-Rotate assumes that the right child exists.

Left-Rotate (t)
1  k  right[t]

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
2  Binary
right[t]
Tree
←left[k] Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…
3  left[k] t ←

4  s[k] s[t]

5  s[t] s[left[t]]+s[right[t]]+1

6  t k  

2 Size Balanced Tree


Size Balanced Tree (abbr. SBT) is a kind of Binary Search Trees kept balanced

 by size. It supports many dynamic primary operations in the runtime of O(logn):

Insert(t,v) Inserts a node whose key is v into the SBT rooted at t.


Delete(t,v) Deletes a node whose key is v from the SBT rooted at t. In the case
that no such a node in the tree, deletes the node searched at last.
Find(t,v) Finds the node whose key is v and returns it.
Rank(t,v) Returns the rank of v in the tree rooted at t. In another word, it is one
 plus the number of the keys which are less than v in that tree.

Select(t,k) Returns the node which is ranked at the kth position. Apparently it
includes operations of Get-max and Get-min because Get-min is
equivalent to Select(t,1) and Get-max is equivalent to Select(t,s[t])
Pred(t,v) Returns the node with maximum key which is less than v.
Succ(t,v) Returns the node with minimum key which is larger than v.

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 5/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…
Commonly every node of a SBT contains key, left, right  and extra but use
updated field: its size, which has been defined in the former introduction. The ker
of a SBT is divided into two restrictions on size:
For every node pointed by t in a SBT, we guarantee that
Property(a):

s[ right [t ]] ≥ s[left [left [t ]]], s[ right [left [t ]]]  


Property(b):

s[left [t ]] ≥ s[ right [ right [t ]]], s[left [ right [t ]]]  

Figure 2.1:The nodes L and R are left and right children of the
node T. The Subtrees A and B, C and D are left and
right subtrees of the nodes L and R respectively.

Correspond to properties (a) and (b), s[ A], s[ B ] ≤ s[ R ] & s[C ], s[ D ] ≤ s[ L ]  

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 6/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles 3 Maintain
Search   Sign In Join

Assume that we need to insert a node whose key is v into a BST. Generally
use the following procedure to accomplish the mission.

Simple-Insert (t,v)
1  If t=0 then 
2  t  NEW-NODE(v)

3  Else 
4  s[t] s[t]+1

BFS and DFS 5Weight


  Balanced
If v<key[t]CS225
then- Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary
6  Tree Run-Times -…
Simple-Insert(left[t],v) Tree - Deleting a… Tricks.pdf Subgraph…

7  Else 

8  Simple-Insert(right[t],v)

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 7/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 8/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 9/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

Trusted by over 1 million members

Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions!

Start Free Trial


Cancel Anytime.

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 10/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 11/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 12/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 13/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 14/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 15/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 16/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 17/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

Trusted by over 1 million members

Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions!

BFS and DFS Weight Balanced CS225 - Start Free


Midterm 2 Trial
5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…
Cancel Anytime.

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 18/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 19/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 20/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 21/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 22/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 23/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 24/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

Trusted by over 1 million members

Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions!

Start Free Trial


Cancel Anytime.

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 25/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 26/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 27/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related
 titles Search   Sign In Join

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Tree Run-Times -… Tree - Deleting a… Tricks.pdf Subgraph…

Reward Your Curiosity


Everything you want to read.
Anytime. Anywhere. Any device.

Read Free For 30 Days


https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 28/30
7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
Related titles Cancel
NoCommitment. Search
anytime.   Sign In Join

Share this document


    

Related Interests
BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Mathematical Logic Applied Mathematics
Binary Tree Run-Times -…
Computer Data Theoretical Computer Science
Tree - Deleting a… Tricks.pdf
Alg
Subgraph…

Documents Similar To 10 陈启峰《Size Balanced Tree》

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (
UPLOADED BY Binary Tree Run-Times - Goo… Tree - Deleting a… Tricks.pdf S
Rajendranbeh… UPLOADED BY UPLOADED BY UPLOADED BY UPLOADED BY U
BODJE N'KAU… Mihir Kumar mani271092 bharathc89

More From yizer

9王欣上《浅谈基 9 王欣上《浅谈基 8 杨哲《凸完全单 7 袁昕颢《动态树 6 李宇骞《浅谈信 6


于分层思想的⽹… 于分层思想的⽹… 调性的⼀个加强… 问题及其应⽤》 息学竞赛中的线… 息
UPLOADED BY UPLOADED BY UPLOADED BY UPLOADED BY UPLOADED BY U

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 29/30


7/16/2019 10 陈启峰《Size Balanced Tree》 | Mathematical Logic | Applied Mathematics
yizer yizer yizer yizer yizer
Related
 titles Search   Sign In Join

Popular in Self Balancing Binary Search Tree

BFS and DFS Weight Balanced CS225 - Midterm 2 5. Binary Search D3-Tips-and- (2012) Regional
Binary Indexed ppopp207-bronson
Binary Tree TREES-…
Run-Times AND IM070449
Tree - Deleting a… Tricks.pdfSelf Balancing
Subgraph…I
Tree UPLOADED BY GRAPHS UPLOADED BY Binary Search Tree A
UPLOADED BY RahulGupta UPLOADED BY Amit Meher UPLOADED BY U
Viraj Kumar MAYA the_swagmaster

ABOUT SUPPORT

About Scribd Help / FAQ

Press Accessibility

Our blog Purchase help

Join our team! AdChoices

Contact Us Publishers

Join today

Invite Friends

Gi s

LEGAL
   
Terms

Privacy

Copyright

Copyright © 2019 Scribd Inc. . Browse Books . Site Directory . Site Language: English

https://www.scribd.com/document/3072015/10- 陈启峰-Size-Balanced-Tree 30/30

S-ar putea să vă placă și