Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
2-3 Tree, Everything you need to know
1. 2-3
TREE
Estrutura de Dados II
Team:
Augusto Teixeira
Carlos Littbarski
Jardel Rodrigues
Victor Apuena
Professor:
Alandson Meireles
2. History
TREE 2-3 WAS THE FIRST MULTIPATHS TREE, INVENTED BY J. E.
HOPCROFT IN 1970.
2-3 trees are an isometry of AA trees, which means that they are
equivalent data structures. In other words, for all 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.
John E. Hopcroft
3. Characteristics
- ARE TREES EASY TO SCHEDULE
- ARE MULTIVITIES TREES
- IT'S NOT A BINARY TREE
- TREES 2-3 ARE SIMILAR TO TREES 2-3-4.
- 2-3 SAY ABOUT THE QUANTITY OF CHILDREN THAT THE TREE CAN HAVE (AS
WELL AS IN 2-3-4)
- PERFECTLY BALANCED
5. Propriedades
- Each node contains one or two keys;
- Each inner node has two children if it has one key, or three if it has two keys;
- All the leaves are on the same level.
- All data is sorted
NODE WITH 1 SON
a a b
P Q
NODE WITH 2 SONS
P Q R
10. Insert: Node 1-key node
b
Otherwise, locate the node to which the value belongs.
If the node has only 1 value, add the value on the node.
a
Rule #2
Rula #3
Insert key in the node always in an orderly fashion.
12. Insert: 2-key node
c
If the leaf node has more than two values, divide the node
and promote the median of the three values for the parent.
a b
Regra #4
Number of keys burst
Promote the median
Break the knot and make the call
16. Insert: Rules
ca
b
d e
If the leaf node has more than two values, divide the node
and promote the median of the three values for the parent.Rule #4
17. Insert: Rules
ca
b d
e
- Each inner node has two children if it has one key, or three if it has two keys;
38. 25 4010
If the parent then has
three values, continue
to divide and promote,
forming a new root
node if necessary
Rule #5
1 35 5015
Limit burst! AGAIN!!!
42. 2-3 Tree
▪ Simple Node:
▪ Contains a key and two links; A left link to a 2-3 tree that
has keys smaller than the node key; And a direct link to a 2-
3 tree that has larger braces;
43. 2-3 Tree
▪ Double Node:
▪ Contains two keys and three links: a left link to a 2-3 tree
that has smaller keys; And a middle link to a 2-3 tree that has
keys between the two keys of the node; And a direct link to a
2-3 tree that has larger braces;
44. Search in a tree 2-3
- It always starts at the root;
- If the searched item is not in the root, it identifies the child
node of the root in which it can be and continues to this node;
- If the item has a value greater than the root, go to the right of
the tree, otherwise go to the left;
- The process repeats itself until the item is found;
78. Removing a tree 2-3
- Removing an item from a tree 2-3 is approximately the reverse of the insertion
process;
- To remove an item, we must first look for it;
- If the item to be removed is on a sheet with two items;
- We simply exclude it;
- We remove it by changing it from the trees;
116. REFERÊNCIAS
USP - “Instituto de Matemática e Estatística”. Disponível em:
https://www.ime.usp.br/~gold/cursos/2002/mac2301/aulas/b-arvore/
LAFORE - ESTRUTURA DE DADOS E ALGORÍTMOS EM JAVA - 2ª EDIÇÃO
WIKIPEDIA - https://pt.wikipedia.org/wiki/%C3%81rvore_2-3
Gross, R. Hernández, J. C. Lázaro, R. Dormido, S. Ros (2001). Estructura de Datos
y Algoritmos Prentice Hall
Ellio B. Koffman Paul A. T. Olfgang (2006) : Objetos, Abstração, Estruturas de
dados e projeto usando C++