(a, b) trees
Add the elements 6 , 4 , 2 , 5 , 3 , 1 in this order into an initial empty (2,3) tree. Then remove the elements 6 , 2 , 5 (in this order). Specify intermediate steps.
A (2-3) tree is a special case of B tree with maximum degree 3
Each node can have 1 element and two pointers to child left and right (here left<root<right)
Or 2 element and 3 pointers left, middle and right(for every element order being left<root<right)
Below is the step by step illustration of insertion and removal of elements in 2-3 tree
(The red border block shows an intermediate step)
INSERT 6

INSERT 4

INSERT 2

INSERT 5

INSERT 3


INSERT 1




REMOVE 6




REMOVE 2



REMOVE 5




B trees java
NAME CSC 236 HW #3 (B-trees & heaps) 1. Given a B-tree of order 5, add the elements 1, 12, 8, 2, 25, 5, 14, 28, 17, 7, 52, 16, 48, 68, 3, 26, 29, 53, 55, 45 into a B-tree in this order. Draw the diagrams to show the B-tree after each element is added. 2. Add the elements 27, 35, 23, 22, 4, 45, 21, 5, 42, 19 into a heap in this order Draw...
Binary Search Trees
(a) 5 pointsl Insert 5, 12, 7, 1, 6, 3, 13, 2, 10, 11 into an empty binary search tree in the given order. Show the resulting BST after every insertion. (b) 5 points) What are the preorder, inorder, and postorder traversals of the BST you have after (a)? (c) 5 points Delete 2, 7, 5, 6, 11 from the BST you have after (a) in the given order Show the resulting BST after every deletion.
5. A three-heap with n elements can be stored in an array A, where A[O] contains the root of the tree. a) Draw the three-heap that results from inserting 5, 2, 8, 3, 6, 4, 9, 7, 1 in that order into an initially empty three-heap. You do not need to show the array representation of the heap. You are only required to show the final tree, although if you draw intermediate trees. b) Assuming that elements are placed in...
• P1 (10 pts) Show the result of inserting 2, 9, 5, 8, 6, 4, 3, 1 into an initially empty AVL tree (draw a resulting tree after inserting each number; you need to draw 8 AVL trees). • P2 (5 pts) What is the minimum number of nodes in an AVL tree of height 8? • P3 (5 pts) Show the result of deleting the element with key 9' from the following splay tree. • P4 (5 pts) Show...
1. Draw the 2-3 trees that result when you insert the keys Y L P M X H C R A E S İn that order into an initially empty tree. There should be 11 trees in all. Use the final tree to construct the corresponding red-black tree. 2. Draw all the structurally different red-black trees (i.e. no specific keys) with n keys for n from 2 to 8.
5. Heap, 5pts] The following elements are inserted into an empty Max-Heap in the fol- la-FHea lowing order: 2, 3. 1, 4, 6. 12, 15, 22, 11, 5 Draw the resulting heap (use the logical (tree) representation)
2-3-4 and Red Black Trees. Do these side by side: Insert the following into a 2-3-4 and Red black tree: {60, 56, 72, 39, 57, 41, 97, 85, 20, 18, 10, 16} (Show your steps etc.) Theory here Explain, from your own observation in a. what it means that the two trees are considered ‘equivalent’. Theory here
question 1,7&10
a) Given the information below: {1, 2, 3, 4, 5, 6} A = {1} B= {4,5) C = {3,6} LIST the elements in each of the following sets: AU ( BCC) Hint Do not use ellipsis, but list each element of the set separated by a comma in numerical order in curly braces that look like this: {}. If the set is empty, type Empty Set without curly braces. (AUB) n(AUC) = Hint Do not use ellipsis, but...
File Edit Format View Help Graphs and trees 4. [6 marks] Using the following graph representation (G(V,E,w)): v a,b,c,d,e,f E fa,b), (a,f),fa,d), (b,e), (b,d), (c,f),(c,d),(d,e),d,f)) W(a,b) 4,W(a,f) 9,W(a,d) 10 W(b,e) 12,W(b,d) 7,W(c,d) 3 a) Draw the graph including weights. b) Given the following algorithm for Inding a minimum spanning tree for a graph: Given a graph (G(V,E)) create a new graph (F) with nodes (V) and no edges Add all the edges (E) to a set S and order them...
problem 4 & 5
1 2 3 4 5 6 Great White (GW) T A C G AG Tiger (T) Hammerhead (H) T Chimaera (C) GIG IT IG 1. (0.5 pts) Which character(s) in the data matrix are parsimony informative? 75, 6 2. (0.5 pts) Which character(s) in the data matrix are parsimony uninformative? Use the diagrams below to 3. (0.5 pts) Draw the three possible unrooted trees for the four taxa in the data matrix. 4. (0.5 pts) Map...