






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The concepts of 2-3 and 2-3-4 trees, which are balanced binary search trees. These trees maintain a balance between the number of nodes at each level to ensure efficient searching. 2-3 trees allow each node to have at most 2 or 3 children, while 2-3-4 trees can have nodes with up to 4 children. The tree structure, insertion, deletion, and the advantages of using these trees.
Typology: Lecture notes
1 / 12
This page cannot be seen from the preview
Don't miss anything!
2-3 tree^ empty
S S L class Tree23Node{Object small; Object large;Tree23Node left; Tree23Node mid;Tree23Node right; }
boolean search(Object item){if(item == null) throw new NullPointerException(“…”); if(isEmpty()) throw new TreeUnderflowException(“…”);Comparable o = (Comparable)item; Tree23Node loc = root;while(loc!=null){ int comp = o.compareTo(loc.small);if(comp<0) loc = loc.left; else if(comp==0) return true;if(loc.large==null) loc = loc.middle; else{comp = o.compareTo(loc.large); if(comp<0) loc = loc.middle;else if(comp==0) return true; } else loc = loc.right; }return false; }
case i-1.
case i-2.
case i-3. case i-5.
case i-4.
2-3-4 treeempty T (^) L T (^) R T (^) L T (^) M T (^) R
insert(55)^60 40 80
10 15 20 50 65 70 90
insert(65)
delete(55) 10 15 20 50 65 70 90
delete(50)