From Wikipedia, the free encyclopedia  View original article
23 tree  

Type  Tree  
Invented  1970  
Invented by  John Hopcroft  
Time complexity in big O notation  
Average  Worst case  
Space  O(n)  O(n) 
Search  O(log n)  O(log n) 
Insert  O(log n)  O(log n) 
Delete  O(log n)  O(log n) 
23 tree  

Type  Tree  
Invented  1970  
Invented by  John Hopcroft  
Time complexity in big O notation  
Average  Worst case  
Space  O(n)  O(n) 
Search  O(log n)  O(log n) 
Insert  O(log n)  O(log n) 
Delete  O(log n)  O(log n) 
In computer science, a 2–3 tree is a tree data structure, where every node with children (internal node) has either two children (2node) and one data element or three children (3nodes) and two data elements. Nodes on the outside of the tree (leaf nodes) have no children and one or two data elements.^{[1]}^{[2]} 2−3 trees were invented by John Hopcroft in 1970.^{[3]}
2–3 trees are an isometry of AA trees, meaning that they are equivalent data structures. In other words, for every 2–3 tree, there exists at least one AA tree with data elements in the same order. 2–3 trees are balanced, meaning that each right, center, and left subtree contains the same or close to the same amount of data.
We say that a node is a 2node if and only if it has one data element and two children if it is an internal node.
We say that a node is a 3node if and only if it has two data elements and three children if it is an internal node.
We say that a node is a 4node if and only if it has three data elements and four children if it is an internal node.
We say that T is a 23 tree if and only if one of the following statements hold:
Searching for an item in a 23 tree is similar to searching for an item in a binary search tree. Since the data elements in each node is ordered, a search function will be directed to the correct subtree and eventually to the correct node which contains the item.
Insertion works by searching for the proper location of the key and adds it there. If the node becomes a 4node then the node is split from two 2nodes and the middle key is moved up to the parent. The diagram illustrates the process.


This computer programming–related article is a stub. You can help Wikipedia by expanding it. 