ADS2_AllSol

pdf

School

University of Florida *

*We aren’t endorsed by this school

Course

5771

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

289

Uploaded by raghurathu

Report
<<< Exam #2 sample solution >>> -- Fall, 1999 1. min BH. (a) min -1--2--7--4--3--5--6--8- (b) delete_min min 2 5 8 | \ | 7 3 6 | 4 2. 2P min PH (a) insert (meld) 3 / \ +------------+ 4 | | | | | / \ 11 10 9 8 7 5 6 (b) delete_min (meld in 2 pass) 4 / / | \ \ 10 8 7 5 6 / | 11 9 (c) decrease_key : 8 --> 2 (meld subtree & main tree) 2 / \
4 9 / / \ \ 10 7 5 6 / 11 3. AVL insert : rotation types used : RR, RL, LR 5 / \ 4 7 / / \ 3 6 8 4. 2-3 tree (a) 4 / \ 2 6,8 / \ / | \ 1 3 5 7 9 delete 3: 6 / \ 4 8 / \ / \ 1,2 5 7 9 (b) 2,4 / | \ 1 3 5,6 insert 7: 4 / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 6 / \ / \ 1 3 5 7 5. RB rotation types / color flips used : RRr,RLb,LLr, LLb 2 / \\ 1 6 / \ 4 7 // \\ 3 5 6. merits of RB o efficient join and split of small & big trees. o no waste of memory space o no data movement within node
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
((( sample Exam #2 solution ))) 1. min F-heap (a) - link in doubly-linked list min -2--3--4--5--6--7--8--9--10- (b) - delete min element. - merge using degree table of size O(logN). 3 / | \ 4 5 7 | | \ 6 8 9 | 10 (c) DecreaseKey(np, val) o reduce the key in the node np by val. o assuming that np is not a min tree root and its key < parent's key, pp = np->parent; delete np and insert it into the list of the min tree roots. np = pp; while( np->ChildCut == True || current node np is NOT root ) { pp = pp->parent; delete np and link to the list of min tree roots; np = pp; } np->ChildCut = TRUE; 2. min 2-pass paring heap (a)
- meld on every insertion 1 | ---------- / / / / \ 5 4 3 2 6 /|\ / | \ 8 7 9 (b) after pass 1: 4 2 6 | | /|\ 5 3 8 7 9 after pass 2: 2 / | \ 4 3 6 | /|\ 5 8 7 9 (c) - remove 6 and merge its children - insert the merged tree into the list of min tree roots 2 / | \ 4 3 7 | / \ 5 8 9 3. AVL rotations : RR -> LL -> RL -> LR 4 / \ 2 6 / \ / \ 1 3 5 7
4. 2-3 tree (a) 4 / \ 2 6 / \ / \ 1 3 5 7 Delete 4: - transform to leaf node deletion - merge in bottom-up 3,6 / | \ 1,2 5 7 (b) 3,6 / | \ 1,2 4,5 7,8 Insert 9: split in bottom-up 6 / \ 3 8 / \ / \ 1,2 4,5 7 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
5. RB tree (a) merge (6,8,9) followed by RRb rotation. 5 // \\ 2 8 / \ / \ 1 3 6 9 \\ \\ // 4 7 10 (b) S x B 1 3 5 \\ / \ 2 4 6 \\ 7
COP 5536 / AD 711R Advanced Data Structures Exam 2 (Mar. 23, 2001) CLOSED BOOK 50 Minutes Note. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses. 1. (a) (2) Insert the following elements into an empty min Fibonacci-heap and show the result: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 (b) (4) Perform DeleteMin operation on the constructed heap, clearly labeling ChildCut value. Show each step. (c) (4) Perform DecreaseKey operation to decrease 17 to 4 and draw the resulting tree. 2. (8) Recall that an Indexed Binary Search Tree ibst has the field leftSize . For any node, the value of its leftSize field is the number of nodes in its left subtree. Write a pseudo code Find-Kth (ibst, k) to locate the k th smallest identifier m in ibst . The run time of your pseudo code should be O( h ), where h is the height of ibst . Show that your algorithm runs in O( h ). Find-Kth (ibst: Tree, k:integer) { if ( ibst == null) error
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
else if (ibst.leftSize == k-1) return (ibst) else if (ibst.leftSize < k-1 ) return( Find-Kth (ibst.rightchild, k – ibst.leftSize)) else return(Find-Kth (ibst.leftchild, k)) 3. (12) Recall that inserting a node to an AVL tree may require LL, LR, RL, or RR rotation. Draw AVL trees where inserting a node requires RL rotation. Remember that there are three cases for RL rotation. For each case, indicate a node to be inserted and draw the resulting AVL tree. 4. (a) (5) Insert keys 9, 8, 7, 2, 6, 1, 4 and 3 into an initially empty 2-3 tree in the given order. Show each step. (b) (5) Delete the minimum key of the root node, showing each step. 5. (10) Consider the two red-black trees S and B shown below (single line denotes black pointer and double line red pointer): S: 2 B: 12 / \\ \\ 1 5 13 / \ 4 6 // \\ 3 7 (a) Perform Join(S, 10, B) operation, showing each step. (b) For the red-black tree S above, perform the Split(3), showing each step. 6. (5) Suppose that a node x is inserted into a red-black tree and then deleted immediately. Is the resulting red-black tree the same as the initial red-black tree? Justify your answer.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. F-heap (ChildCut: T(true), F(false)) (a) min 2 6 1 10 20 / \ | | | \ (T)4 5(T) 7(T) 9(T) 11(T)12(T) | 13(T) *********************************************************** (b) The below solution is right answer for (b). (6:full points answer) delete operation didn't join(or combine) steps except deletemin operation) min 2 6 1 11 12(T) 20 / \ | | | (T)4 5(T) 7(T) 9(T) 13(T) ************************************************************ the below solution is wrong but I give 4 partial points if you write answer like below. (*Remember : 10 is not min element in this tree, so you don't need to combine steps*) min 1 2 / | \ / \ (T)9 (F)6 11(F) (T)4 5(T) | | \ (T)7 20(T) 12(T) | 13(T) ************************************************************* 2. min 2-pass paring heap (a) - meld on every insertion 1 | ---------- / / / / \
5 4 3 2 6 /|\ / | \ 8 7 9 (b) after pass 1: 4 2 6 | | /|\ 5 3 8 7 9 after pass 2: 2 / | \ 4 3 6 | /|\ 5 8 7 9 (c) - remove 6 and merge its children - insert the merged tree into the list of min tree roots 2 / | \ 4 3 7 | / \ 5 8 9 3. a.Deletion of 4 8 / \ 5 12 / \ / \ 2 7 10 14 / \ / / \ / \ 1 3 6 9 11 13 15 b.Insertion of 16 5 / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3 12 / \ / \ 2 4 8 14 / / \ / \ 1 7 10 13 15 / / \ \ 6 9 11 16 4. 24 , 40 / | \ 2 , 22 30 48 / | \ / \ / \ 1 5,11,19 23 29 31,32,36 41,42,43 50 29 / \ 2 , 22 32 , 40 , 48 / | \ / / \ \ 1 5,11,19 23 30 36 41,42,43 50 5. red-black tree (a) Join(S,12,B) i) follow the right-child pointer until rank(B) == rank(x), where rank(B) == 1, x is a node pointer of tree S. S: 3 B: 15 rank(B) == 1 / \\ // 2 9 13 / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
7 10 <-- x // \\ \\ 5 8 11 ii) combine subtree x, 12, and tree B 12 / \ 10 15 \\ // 11 13 iii) connect the combined tree to node 7 through red pointer. 3 / \\ 2 9 / \\ 7 12 //\\ / \ 5 8 10 15 \\ // 11 13 iv) perform RR rotation to remove consecutive red pointers. 9 // \\ 3 12 / \ / \ 2 7 10 15 //\\ \\ // 5 8 11 13 (b) Split(5,S,x,B) for tree S. i) find node 5 and copy node value to x. Since node 5 has left and right child, Init:: tree S is NULL(left subtree) and tree B is NULL (right subtree). ii) perform Join(B, 7, NULL).
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
B: 7 \\ 8 iii) Join(B, 9, right-subtree of node 9). B: 9 / \ 7 10 \\ \\ 8 11 iv) Join(left-subtree of node 3, 3, S). S: 2 \\ 3 So, the result of split operation: S: 2 x: 5 B: 9 \\ / \ 3 7 10 \\ \\ 8 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. F-heap (ChildCut: T(true), F(false)) (a) min 1 7 2 15 / \ | | | (T)3 5(T) 9(T) 13(T) 16(T) (b) min 2 / | \ (T)13 (F)15 3(F) | | \ (T)16 5(F) 7(F) | 9(T) 2. Find-kth(ibst:tree, k:integer) { if (ibst == nulll) error else if (ibst.leftSize == k-1) return (ibst) else if (ibst.leftSize < k-1) return (Find-kth(ibst.rightchild, k-ibstSize)) else return (Find-kth(ibst.leftchild,k)) } 3. AVL tree (balance factor 0 is not shown). (1) (a) ____10____ / \ __5__ __12__ / \ / \ 3 7 11 13 / \ / \ 1 4 6 9 (b) o insert 8 : LR rotation
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
____ 7 ____ (1) / \ __5__ __10__ / \ (1) / \ 3 6 9 12 / \ / / \ 1 4 8 11 13 o insert 2 : LL rotation ____ 7 ____ / \ __3__ __10__ (-1)/ \ (1) / \ 1 5 9 12 \ / \ / / \ 2 4 6 8 11 13 4. Original Tree (two version) 6 4,8 / \ / | \ 3 9 2 6 10 / \ / \ / \ / \ / \ 1,2 4,5 7,8 10,11 1 3 5 7 9 11 After first deletion: 6 8 / \ / \ 2 9 4,6 10 / \ / \ / | \ / \ 1 4,5 7,8 10,11 1,3 5 7 9 11 After second deletion: 6 6 / \ / \ 2 9 4 8 / \ / \ / \ / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1 4,5 7,8 10 1,3 5 7 9,10 5. red-black tree (a) Join(S,10,B) i) follow the right-child pointer until rank(B) == rank(x), where rank(B) == 1, x is a node pointer of tree S. S: 3 B: 13 rank(B) == 1 / \\ \\ 1 7 14 / \ 5 9 <-- x // \\ \\ 4 6 10 ii) combine subtree x, 10, and tree B 12 / \ 9 13 \\ \\ 10 14 iii) connect the combined tree to node 5 through red pointer. 3 / \\ 1 7 / \\ 5 12 //\\ / \ 4 6 9 13 \\ \\ 10 14 iv) perform RR rotation to remove consecutive red pointers. 7 // \\ 3 12 / \ / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1 5 9 13 //\\ \\ \\ 4 6 10 14 (b) Split(5,S,x,B) for tree S. i) find node 5 and copy node value to x. Since node 5 has no child, tree S is NULL (left subtree) and tree B is NULL (right subtree). ii) perform Join(S, 4, NULL). perform Join(B, 6, NULL). S: 4 B: 6 iii) Join(B, 7, right-subtree of node 7). B: 7 / \ 6 9 \\ 10 iv) Join(left-subtree of node 3, 3, S). S: 3 // \\ 1 4 So, the result of split operation: S: 3 x: 5 B: 7 // \\ / \ 1 4 6 9 \\ 10
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Sample solution Final Exam, Fall 2002 1. a) After insert 75. a ( 30 50 ) / | \ b(10 15) c(35,40 45) d(55 60 70 75) After insert 65 ( 30 50 65 ) / | \ \ (10 15)(35 40 45) (55 60) e(70 75) b) We have the same assumption as in text that there is enough internal memory to hold all nodes accessed during an operation. Insert 75: 3 disk accesses (2 to read a and d, and 1 to write updated node d) Insert 65: 5 disk accesses (2 to read a and d, and 3 to write nodes d, e and a) c) delete 15. ( 35 50 ) / | \ (10 30) (40 45) (55 60 70) delete 55. ( 35 50 ) / | \ (10 30) (40 45) (60 70) delete 35. ( 50 ) / \ (10 30 40 45) (60 70)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2. Part 1: After RR Rotation. 5 / \ 4 f / \ 3 e / \ c d After LR Rotation 5 / \ 2 7 / \ / \ b 4 f g / \ 3 e / \ c d After RL Rotation. 5 / \ 1 8 / \ / \ a 2 7 h / \ / \ b 4 f g / \ 3 e / \ c d Part B: after searching for a key i., create a new node q, set q -> key to some value other than i to indicate that there is no record in a tree with key i, and then insert q into the search external node. (i.e., id ther search stoped where p->LeftChild = 0, insert q into p->LeftChild).
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Because of splays, q will becaome the new root of a tree and it easa splict. 3. node: <label>:<bitnumber>:<key>. After inserting 001000: a:0:001000 / a After inserting 001010: a:0:001000 / b:5:001010 / \ a b After inserting 111110: a:0:001000 / c:1:111110 / \ b:5:001010 c / \ a b After inserting 001011: a:0:001000 / c:1:111110 / \ b:5:001010 c / \ a d:6:001011 / \ b d
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
After inserting 100000: a:0:001000 / c:1:111110 / \ b:5:001010 e:2:100000 / \ / \ a d:6:001011 e c / \ b d After inserting 110010: a:0:001000 / c:1:111110 / \ b:5:001010 e:2:100000 / \ / \ a d:6:001011 e f:3:110010 / \ / \ b d f c After deleting 0101: a:0:001000 / f:1:110010 / \ b:5:001010 e:2:100000 / \ / \ a d:6:001011 e f / \ b d 4. (10,12) [0,24) [0,24) (10,12) [0,24) (3,4) I (8,16) / I(3,4) /
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
====> [0,12) (8,16) ====> [0,12) (10,12) \ (8,16) [6,12) [0,24) (3,4) / \ I(23,6) [0,12) (10,12) (23,6) [12,24) ====> \ (8,16) [6,12) [0,24) (3,4) / \ I(13,18)[0,12) (10,12) (23,6) [12,24) ====> \ / (8,16) [6,12) (13,18) [12,18) [0,24) (3,4) / \ I(17,9) [0,12) (10,12) (23,6) [12,24) ====> \ / (8,16) [6,12) (17,9) [12,18) / (13,18) [12,15) 5. (a) (a) If the pixel [i,j] is to the NW,NE, SW, or SE of current partitioning line, go to NW, NE, SW, or SE child. repeat this until a leaf node is reached. This leaf node is the corresponding node to the pixel. You can initialize all the leaf nodes of the quadtree using the scheme in the question (a). This takes O(NlogN) time where N(n^2) is the number of pixels in the image. Then, all internal nodes can be initialized by just traversing in post-order using black, white, and gray colors which takes O(N). So, the total time complexity is O(NlogN). While traversing the tree, you can add the number of pixels in a node if the node stands for white. The number of pixels in the node can be easily computed using tree level (that is, the number of pixels in a node
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
is 4^l where l is tree level). Of course, if current node is gray, you'll need go down until white node. (b) find_points(kd_node node, int x, int y) if (node == NULL) return; if (node.x > X and node.y > Y) output node; if ( x.discriminator( node ) ) { if (node.x < X) find_points(node->right, x, y); if (node.x > X) { find_points(node->right, x, y); find_points(node->left, x, y); } } if ( y.discriminator( node ) ) { if (node.y < Y) find_points(node->right, x, y); if (node.y > Y) { find_points(node->right, x, y); find_points(node->left, x, y); } }
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
================================================= Exam01 Solution ================================================= 1. F-heap (ChildCut: T(true), F(false)) (a) min 3 6 2 1 20 / \ | | | \ (T)4 5(T) 7(T) 9(T) 11(T)12(T) | 13(T) (b) After deleteMin operation, we need to combine steps like below: min 2 3 / | \ / \ (T)9 (F)6 11(F) (T)4 5(T) | | \ (T)7 20(F) 12(F) | 13(T) 2. (a) 4 5 9 9 20 20 => | => | => / | => | => / | 4 5 8 5 9 12 9 | | / | / | 4 4 8 5 8 5 | | 4 4 20 20 20 => / / | => / / / | => / / / / | 3 12 9 14 3 12 9 15 14 3 12 9 / | /| /| 8 5 8 5 8 5 | | | 4 4 4
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(b) 15 12 9 15 meld(15,9) 15 | | /| => / | ========> / / | 14 3 8 5 12 14 9 12 14 | | / | | 4 3 8 5 3 | 4 3. 11 / \ 7 20 / \ / \ 3 9 14 32 / = / \ / \ 1 12 17 27 37 / 25 Part a: delete 9. 11 / \ (2) 7 20 / / \ 3 14 32 / / \ / \ 1 12 17 27 37 / 25 R1 Rotation 11 (-2) / \ (0) 3 20 (-1) / \ / \ 1 7 14 32 (1) / \ / \ 12 17 27 37 / 25 L0 Rotation 20 (1) / \ 11 (0) 32 (1) / \ / \ 3 14 27 (1) 37 / \ / \ / 1 7 12 17 25
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Part b: Insert 26 11 / \ 7 20 / \ / \ 3 9 14 32 / / \ / \ 1 12 17 27 37 / 25 \ 26 LR Rotation 11 / \ 7 20 / \ / \ 3 9 14 32 / / \ / \ 1 12 17 26 37 / \ 25 27 Insert 29 11 / \ 7 20 / \ / \ 3 9 14 32 (2) / / \ / \ 1 12 17 26 37 / \ 25 27 \ 29 LR Rotation: 11 (-1) / \ 7(1) 20 (-1) / \ / \ 3(1) 9 14(0) 27 (0) / / \ / \ 1 12 17 26 (1) 32 / / \ 25 29 37
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4. (a) ( 4, 8) (4,8) / | \ Insert 13 / | \ / | \ ===> / | \ (1, 3) (6, 7) (10) (1,3) (6,7) (10,13) (4,8) (4,8) Insert 5 / | \ / | \ + 6 ===> / | \ ===> / | \ \ (1,3) (5)(6,7) (10,13) (1,3) (5) (10,13) 7 (6) / \ / \ (4,6,8) (4) (8) / | \ / \ / \ ===> / | \ ===> / \ / \ (1,3) (5) (7) (10,13) (1,3) (5) (7) (10,13) (b) (7) (5) / \ / \ / \ Delete 7 / \ (3) (12) ===> (3) (12) / \ / \ / \ / \ / \ / \ / \ / \ (1) (5) (9) (14) (1) ( ) (9) (14) (5) (5, 12) / \ / | \ / \ Delete 7 / | \ ===> ( ) (12) ===> (1,3) (9) (14) / / \ / / \ (1,3) (9) (14) Delete 14 (5) ===> / \ / \ (1,3) (9,12)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
5. Red-Black Trees (a) 5 Insert 6 / \ ==== L 3 8 // 7 // 6 5 5 5 LLb / \ Insert 10 / \ RRr / \\ ===> 3 7 ===> 3 7 ===> 3 7 // \\ // \\ / \ 6 8 6 8 6 8 \\ \\ 10 10 5 5 5 Insert 1 / \\ Insert 2 / \\ LRb / \\ ===> 3 7 ===> 3 7 ===> 2 7 // / \ // / \ // \\ / \ 1 6 8 1 6 8 1 3 6 8 \\ \\ \\ \\ 10 2 10 10 (b) Step 1: Search 6 and copy it to x. Initialize S and B to NULL. (S=NULL, B=NULL) Step 2: S=NULL B=join(B, 7, 8) B: 8 // \\ 7 10 Step 3: S=(2,5,S) B= same as above S: 2 2 // \\ RRr / \ 1 3 ===> 1 3 \\ \\ 5 5
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
================================================= Exam02 Solution ================================================= 1. F-heap (ChildCut: T(true), F(false)) (a)The solution can be represented in more than one way. After deleteMin operation, we need to combine steps like below: 4 degree 1 4 | ===> / | degree 2 5(F) 5(F) 15(F) ======> | 22(T) min 3 7 / | \ / \ (T)11 (T)12 4(F) (T)8 9(T) | \ | 5(F) 15(F) 10(T) | 22(T) (b) min 3 7 2 / | \ / \ | (T)11 (F)12 4(T) (T)8 9(T) 22(T) | | 5(F) 10(T) 2. (a) 5 5 5 15 15 15 => | => / | => | => / | => / / | 3 1 3 5 7 5 8 7 5 / | / | / | 1 3 1 3 1 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
15 15 15 => / / / | ==> / / / / | ==> / / / / / | 12 8 7 5 2 12 8 7 5 2 12 4 8 7 5 / | /| / | 1 3 1 3 1 3 (b) two pass method 12 8 7 meld(12,8) 12 meld(12,7) 12 | | | ===== => / | ========> / / | 2 4 5 8 2 7 8 2 /| | | | 1 3 4 5 4 / | 1 3 3. a) 2, 1, 3, and 5 are inserted normally. Then a single rotation inserts 4, yielding 2 / \ 1 4 / \ 3 5 The insertion of 8 requires a single rotation at the root, resulting in 4 / \ 2 5 / \ \ 1 3 8 Next 7 is inserted, which requires a double rotation 4 / \ 2 7 / \ / \ 1 3 5 8 Finally, 6 is inserted yielding the result: 4 / \ 2 7 / \ / \ 1 3 5 8 \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
6 part b: 30 / \ 20 55 / \ / \ 15 25 45 60 / \ / \ / == 5 17 23 27 43 / 21 30 / \ 20 55 / \ / 15 25 45 / \ / \ / 5 17 23 27 43 / 21 R1 Rotation 30 (2) / \ 20 (-1) 45 (0) / \ / \ 15 25 43 55 / \ / \ 5 17 23 27 / 21 R-1 Rotation 25 (0) / \ 20 (0) 30 (-1) / \ / \ 15 23 27 45 / \ / / \ 1 7 21 43 55
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4. (a) The solution can be represented in more than one way. 25 / \ 21 42 // \ // \\ 3 24 29 60 / \ / \ / \ 1 13 27 36 45 55 // \\ // // \\ 4 19 34 44 50 (b) 24 / \ / \ ( 3 , 21 ) (29 , 42 , 60 ) / | \ / | | \ / | \ / | | \ 1 (4,13,19) 27 (34,36) (44,45,50) 650 24 / \ / \ ( 3 , 19 ) (29 , 42 , 60 ) / | \ / | | \ / | \ / | | \ 1 (4,13) 21 27 (34,36) (44,45,50) 650 5. Red-Black Trees (a) 5 5 5 / \ / \ / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Rb1 2 15 2 15 2 15 ==> / \ // \ insert(12) / \ // \ RRb / \ // \ 1 3 8 18 ===> 1 3 8 18 =====> 1 3 8 18 / \ / \ / \ 6 9 6 9 6 10 \\ \\ // \\ 10 10 9 12 \\ 12 (b) Step 1: Search 8 and copy it to x. Initialize S and B to NULL. (S=NULL, B=NULL) Step 2: S= 6 B= 9 \\ 10 Step 3: S= 6 B=join(B, 15, 18) B: 15 / \ 9 18 \\ 10 Step 4: S= join(3, 5, S) B= same as above S: x = 8 B: 3 / \ / \\ 9 18 2 5 \\ // / \ 10 1 4 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Fall 2003 Exam02_solution question 1. min | V 20 3 1 | / \ / / | 25 7 5 13 15 18 | / | | 9 14 26 17 | | 19 30 (a) delete (1) = min min | V 20 3 13 15 18 | / \ / \ | 25 7 5 14 26 17 | | | 9 19 30 joins two min F-heaps with same degree 2 and degree 1 3 15 18 / / | / | (F)13 7 5 (F)20 17 / | | | | 14 26 9 25 30 | 19 (b) DecreaseKey
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3 15 18 14 19 / / | / | (T)13 7 5 (F)20 17 | | | | 26 9 25 30 (2) There was a typo in part(a). The balance factor of the root should be -1 instead of +1. I am very sorry for the problem. Thus, I provide sample solutions for the two versions. Remember that you need to identify imbalance type from the node whose balance factor becomes either +2 or -2 when a node is inserted. Version 1: The balance factor of the root is -1. (a) 5 / \ 3 10 / \ / \ 2 4 7 12 / \ / \ 6 9 11 13 (b) insert 8 (RL) 7(0) / \ 5(1) 10 / \ / \ 3 6 9(1) 12 / \ / / \ 2 4 8 11 13 insert 1 (LL) 7(0) / \ 3(0) 10 / \ / \ 2(1) 5 9(1) 12 / / \ / / \ 1 4 6 8 11 13
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Version 2: The root is "10" and has balance factor +1. (a) 10 / \ 9 12 / \ / \ 4 6 11 13 / \ / \ 2 3 5 7 (b) insert 8 (LR) 10 / \ 5 12 / \ / \ 3 7 11 13 / \ / \ 2 4 6 9 7(0) / \ 5(1) 10 / \ / \ 3 6 9(1) 12 / \ / / \ 2 4 8 11 13 insert 1 (LL) 7(0) / \ 3(0) 10 / \ / \ 2(1) 5 9(1) 12 / / \ / / \ 1 4 6 8 11 13 (3) (a)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
10 I(5) 10 LLb 8 I(1) 8 // ===> // ===> // \\ ===> // \\ 8 8 5 10 5 10 // // 5 1 LLr 8 I(3) 8 LRb 8 ===> / \ ===> / \ ===> / \ 5 10 5 10 3 10 // // // \\ 1 1 1 5 \\ 3 I(7) 8 RRr 8 ===> / \ ===> // \ 3 10 3 10 // \\ / \ 1 5 1 5 \\ \\ 7 7 (b) Step 1. Follow the left child pointers from the root of B to first node x whose rank equals rank(S) = 1. 6 <--- x // 5 Step 2. Combine S, 4, and subtree rooted at 6. 4 / \ 3 6 // // 2 5 Step 3. Combine the result of Step 2 to node "7" through a red pointer. 11 // \ 7 13 // \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4 9 / \ // \\ 3 6 8 10 // // 2 5 Step 4. Imbalance (LLb --> rotate) 7 // \\ 4 11 / \ / \ 3 6 9 13 // // // \\ 2 5 8 10
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Exam02 solution. Spring 2003 1. (part a) (after DecreaseKey) min | V 1 15 19 2 13 / | \ | 14 7 9 (T) 17(T) | / 11 10 | 32 (part b) 14 7 9 15 19 2 13 | | | 11 10 17 | 32 2 7 9 15 14 | | | | | 13(F) 11 10 17 19(F) | 32 2 9 14 / | / | | 13(F) 7(F) 10 15 (F) 19(F) | | 11(T) 17 | 32(T) 2 14 / / | | 13(F) 7(F) 9(F) 19(F)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
| / | 11(T) 10 15(F) | | 32(T) 17(T) 2) 35 / \ 20 45 (1) / \ / \ 14 30 40(-1) 50 (-1) / \ / \ / \ \ 12 13 26 34 37 43 55 / / == 24 41 Part a: delete 55. 35 / \ 20 45 (2) / \ / \ 14 30 40(-1) 50(0) / \ / \ / \ 12 13 26 25 37 43 / / 24 41 R-1 Rotation 35 (1) / \ 20 (-1) 43 (0) / \ / \ 14 30 40(0) 45(-1) / \ / \ / \ \ 12 13 26 34 37 41 50 / 24 Part b: Insert 21
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
35 (1) / \ 20 (-1) 45 (1) / \ / \ 14 30 40 50 / \ / \ / \ \ 12 13 26(2)34 37 43 55 / / 24 41 / 21 LL Rotation 35 (1) / \ 20 (-1) 45 (1) / \ / \ 14 30 40 50 / \ / \ / \ \ 12 13 24 34 37 43 55 / \ / 21 26 41 Insert 28 35 / \ 20 45 / \ / \ 14 30(2) 40 50 / \ / \ / \ \ 12 13 24 34 37 43 55 /\ / 21 26 41 \ 28 LR Rotation: 35
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
/ \ 20 45 / \ / \ 14 26(-1) 40 50 / \ / \ / \ \ 12 13 24 30 37 43 55 / / \ / 21 28 34 41 35 (0) / \ 20 (-1) 45 (1) / \ / \ 14(0) 26(0) 40(-1) 50(-1) / \ / \ / \ \ 12(0) 13(0) 24(1) 30(0) 37(0) 43(1) 55 / / \ / 21(0) 28(0) 34(0) 41 3. Two possibilities (a) 6 4,8 / \ / | \ 3 9 2 6 10 / \ / \ / \ / \ / \ 1,2 4,5 7,8 10,11 1 3 5 7 9 11 (b) after the first deletion 6 8 / \ / \ 2 9 4,6 10 / \ / \ / | \ / \ 1 4,5 7,8 10,11 1,3 5 7 9 11 after the second deletion 5 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
/ \ / \ 2 9 4 10 / \ / \ / \ / \ 1 4 7,8 10,11 1,3 5,6 9 11 4. (a) I(10) I(7) LLb I(2) 12 ===> 12 ===> 12 ===> 10 ===> 10 // // // \\ // \\ 10 10 7 12 7 12 // // 7 2 LLr 10 I(6) 10 LRb 10 ===> / \ ===> / \ ===> / \ 7 12 7 12 6 12 // // // \\ 2 2 2 7 \\ 6 I(9) 10 RRr 10 ===> / \ ===> // \ 6 12 6 12 // \\ / \ 2 7 2 7 \\ \\ 9 9 (b) D(9) 5 D(10) 5 ===> // \\ ===> // \\ 2 8 2 7 / \ / \ / \ / \ 1 3 6 10 1 3 6 8 \\ 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(c) Step 1. S=null, B=( 7 ) Step 2. S=null, B=join(B, 8, 9) \\ 10 B= 8 RRr 8 // \\ ===> / \ 7 9 7 9 \\ \\ 10 10 Step 3. S=join(2,5,S), B=same as that of step 2. S= 2 / \ 1 3 \\ 5 Final S= 2 B = 8 / \ / \ 1 4 7 9 \\ \\ 5 10 The End.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni Spring, 2004 Advanced Data Structures (COP 5536 /AD 711R) Exam 2 CLOSED BOOK 60 Minutes Name: NOTE: 1. For all problems, use only the algorithms discussed in class/text. 2. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 3. The points assigned to each question are provided in parentheses.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. (12) For the following min Fibonacci heap. (The ChildCut of field shown in parentheses; ChildCut is undefined for the root.) min | V 1 13 / / \ 2(F) 4(T) 3(T) / | / | (T)6 5(F) 10(T) 5(T) | | (T)8 9(F) / | | (F)9 15(T) 11(T) | 18(T) Figure 1. Min Fibonacci heap (a) (6) For the min Fibonacci heap of figure 1, perform a DecreaseKey operation by changing 15 to 2. Draw the resulting min Fibonacci heap, clearly label ChildCut value. (b) (6) For the min Fibonacci heap of figure 1, perform a Delete the min element. Draw the resulting min Fibonacci heap, clearly label ChildCut value.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2. (11) For AV L trees, (a) (6) Start with an empty AVL tree, and perform insert operations using the following keys in the order: 6, 8, 7, 4, 5, and 3. Show each step. (b) (5) Delete key 9 from the following AVL tree. Show each step and specify imbalance type. 4 / \ 2 8 / \ / \ 1 3 6 9 / \ 5 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3. (15) Start with an empty two - pass max pairing heap, (a) (5) Insert the following sequence of keys: 2, 5, 8, 4, 7, 12, 3, and 9 in this order. Draw the resulting max pairing heap. (b) (5) Perform a IncreaseKey(8,10) operation, which increase the 8 to 18, on the resulting max pairing heap of (a). Show the resulting max pairing heap. (c) (5) For the max pairing heap of figure 2 below, perform a RemoveMax operation using two - pass scheme and show each step. 15 / / / | \ \ \ 10 13 12 11 5 9 7 Figure 2. max pairing heap
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4. (12) Use the bottom - up (2-pass) algorithms of red - black trees for this problem. Double lines indicate a red edge and single line a black edge. (a) (7) Insert keys 7, 6, 4, and 3 (in this order) into the following red-black tree. Show each step and specify rotation type/color flip if applied. 2 // \\ 1 5 (b) (5) Delete key 14 from the following red-black tree. Show each step and specify rebalancing type. 10 / \\ 8 14 // \\ / \ 7 9 12 15 // \\ 11 13
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Exam02_solution Spring, 2004 question 1. DecreaseKey operation by changing 15 by 2 min | V 1 13 2 8 6 / / \ | | 2(T) 4(T) 3(T) 18(T) 9(F) | / | 5(F) 10(T) 5(T) | 9(F) | 11(T) DeleteMin operation. min | V 2 3 / | \ | (T)6 5(F) 4(F) 13(F) | / | (T)8 10(T) 5(T) / | | (F)9 15(T) 9(F) | | 18(T) 11(T) (2) (a) 6 7 7 7 \ RL / \ I(4) / \ I(5) / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
8 ===> 6 8 ===> 6 8 ===> 6 8 / / / 7 4 4 \ 5 7 7 5 LR / \ I(3) / \ LL / \ ===> 5 8 ===> 5 8 ===> 4 7 / \ / \ / / \ 4 6 4 6 3 6 8 / 3 (b) delete 9 4 / \ 2 8(2) <-- A / \ / 1 3 6(0) / \ 5 7 A is the nearest ancestor of the deleted node. (R0) 4 / \ 2 6 / \ / \ 1 3 5 8 / 7 3) (a) tree with smaller root becomes leftmost subtree. Insert 5 Insert 8 Insert 4 2 ==> 5 ==> 8 ==> 8 | | / \ 2 5 4 5 | | 2 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Insert 7 Insert 12 Insert 3 ==> 8 ==> 12 ==> 12 / / | | / | 7 4 5 8 3 8 | / / | / / | 2 7 4 5 7 4 5 | | 2 2 Insert 9 =======> 12 / / | 9 3 8 / / | 7 4 5 | 2 (b) 12 18 meld two heaps 18 / | / / | ========> / / / | 9 3 7 4 5 12 7 4 5 | / | | 2 9 3 2 (c) two-pass meld after remove min pass 1: start subtrees left to right. 13 12 9 7 | | | 10 11 5 the number of subtrees was odd, meld remaining original subtree with newly generated subtree. 13 12 9 | | / | 10 11 7 5 Pass 2: start with rightmost subtrees of pass 1 12 13
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
/ | step2 / | 9 11 ===> 12 10 / | / | 7 5 9 11 / | 7 5 (4) (a) I(7) 2 RRr 2 I(6) 2 ===> // \\ ===> / \ ===> / \ 1 5 1 5 1 5 \\ \\ \\ 7 7 7 // 6 2 2 RLb / \ I(4) / \ ===> 1 6 ===> 1 6 // \\ // \\ 5 7 5 7 // 4 2 2 LLr / \\ I(3) / \\ ==> 1 6 ===> 1 6 / \ / \ 5 7 5 7 // // 4 4 // 3 2 LLb / \\
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
==> 1 6 / \ 4 7 // \\ 3 5 (b) delete 14 10 / \\ 8 15 // \\ / \ 7 9 12 y // \\ 11 13 Rb2 10 / \\ 8 13 // \\ / \ 7 9 12 15 // 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni Spring, 2004 Advanced Data Structures (COP 5536 /AD 711R) Exam 2 - Make-up CLOSED BOOK 60 Minutes Name: NOTE: 1. For all problems, use only the algorithms discussed in class/text. 2. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 3. The points assigned to each question are provided in parentheses.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. (14) For the following min Fibonacci heap, assume that the ChildCut field of all node is TRUE (However, the ChildCut of a root node is undefined). min | V 20 3 1 | / \ / / \ 25 7 5 13 15 18 | / | | 9 14 26 17 | | 19 30 (a) (7) Delete the min element. Show each step and clearly label ChildCut values. (b) (7) Perform a DecreaseKey operation by changing 19 to 6 on the resulting Fibobacci heap of (a), clearly label ChildCut values (Draw the resulting Fibonacci heap.)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2. (12) For AVL trees, (a) (6) Construct an AVL tree with following keys: 2,3,4,5,6,7,9,10,11,12, and 13. The root node of the constructed AVL tree must have the key 5 and balance factor +1. All nodes other than the root node have the balance factor 0. (Note: Do not insert the keys in the given sequence.) (b) (6) Insert 8 and 1, in this order, into the AVL tree of Part (a). Show each result and clearly label balance factors and rotation types.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3. (10) Draw a 2-3 tree with 11 elements (keys from 1 to 11) and height 3, where all nodes at levels 2 and 3 are 2-nodes (the root is at level 1). Delete the element in the rightmost node at level 2 and draw the resulting 2-3 tree. From the resulting tree, delete the min element. Draw the new 2-3 tree.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4. (14) For red-black trees, use the bottom - up algorithm for this problem. (a) (7) Construct a red-black tree by inserting the keys in the following sequence into an initially empty red-black tree: 10, 8, 5, 1, 3, and 7 S: 3 B: 11 // // \ 2 7 13 / \ 6 9 // // \\ 5 8 10 Figure. Red-black trees (b) (7) For the red-black trees S and B shown above, perform Join ( S, 4 , B ) operation, showing each step. Double edge indicates a red pointer and single edge indicates a black pointer.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Spring 2004 make-up exam Exam02_solution question 1. min | V 20 3 1 | / \ / / | 25 7 5 13 15 18 | / | | 9 14 26 17 | | 19 30 (a) delete (1) = min min | V 20 3 13 15 18 | / \ / \ | 25 7 5 14 26 17 | | | 9 19 30 joins two min F-heaps with same degree 2 and degree 1 3 15 18 / / | / | (F)13 7 5 (F)20 17 / | | | | 14 26 9 25 30 | 19 (b) DecreaseKey
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3 15 18 14 19 / / | / | (T)13 7 5 (F)20 17 | | | | 26 9 25 30 (2) (a) 10 / \ 9 12 / \ / \ 4 6 11 13 / \ / \ 2 3 5 7 (b) insert 8 (LR) 10 / \ 5 12 / \ / \ 3 7 11 13 / \ / \ 2 4 6 9 7(0) / \ 5(1) 10 / \ / \ 3 6 9(1) 12 / \ / / \ 2 4 8 11 13 insert 1 (LL) 7(0) / \ 3(0) 10 / \ / \ 2(1) 5 9(1) 12
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
/ / \ / / \ 1 4 6 8 11 13 3. (a) 2-3 tree with 11 keys 4, 8 / | \ 2 6 10 / \ / \ / \ 1 3 5 7 9 11 (b) delete "10" First, transform deletion from interior to deletion from a leaf. 4, 8 / | \ 2 6 9 / \ / \ / \ 1 3 5 7 ( ) 11 4, 8 / | \ ===> 2 6 ( ) / \ / \ | 1 3 5 7 9,11 4 / \ ===> 2 6,8 / \ / | \ 1 3 5 7 9,11 (c) delete "1" 4 / \ 2 6,8 / \ / | \ () 3 5 7 9,11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4 / \ ===> ( ) 6,8 | / | \ 2,3 5 7 9,11 6 / \ ===> 4 8 / \ / \ 2,3 5 7 9,11 (4) (a) 10 I(5) 10 LLb 8 I(1) 8 // ===> // ===> // \\ ===> // \\ 8 8 5 10 5 10 // // 5 1 LLr 8 I(3) 8 LRb 8 ===> / \ ===> / \ ===> / \ 5 10 5 10 3 10 // // // \\ 1 1 1 5 \\ 3 I(7) 8 RRr 8 ===> / \ ===> // \ 3 10 3 10 // \\ / \ 1 5 1 5 \\ \\ 7 7 (b) Step 1. Follow the left child pointers from the root of B to first node x whose rank equals rank(S) = 1.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
6 <--- x // 5 Step 2. Combine S, 4, and subtree rooted at 6. 4 / \ 3 6 // // 2 5 Step 3. Combine the result of Step 2 to node "7" through a red pointer. 11 // \ 7 13 // \ 4 9 / \ // \\ 3 6 8 10 // // 2 5 Step 4. Imbalance (LLb --> rotate) 7 // \\ 4 11 / \ / \ 3 6 9 13 // // // \\ 2 5 8 10
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni 2005 Advanced Data Structures (COP 5536 /NTU AD 711R) Exam 2 CLOSED BOOK 70 Minutes Name: NOTE: All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. (a) (10) Insert the following elements into an empty min Fibonacci-heap and show the result: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 (b) (20) Perform DeleteMin operation on the constructed heap, clearly labelling ChildCut value. Show each step. (c) (20) Perform DecreaseKey operation to decrease 17 to 4 and draw the resulting tree.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2. (50) Recall that an Indexed Binary Search Tree ibst has the field leftSize . For any node, the value of its leftSize field is the number of nodes in its left subtree. Write a pesudo code FindK th ( ibst, k ) to locate the k th smallest identifier m in ibst . The run time of your pseudo code should be O ( h ), where h is the height of ibst .
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3. (50) Recall that inserting a node into an AVL tree may require LL, LR, RL, or RR rotations. Draw AVL trees in which inserting a node requires an RL rotation. Remember that there are three cases for RL rotation. For each case, indicate a node to be inserted and draw the AVL tree following the insertion.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4. (a) (25) Insert keys 9, 8, 7, 2, 6, 1, 4 and 3 into an initially empty 2-3 tree in the given order. Show each step. (b) (25) Delete the minimum key of the root node, showing each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
5. (50) Consider the two red-black trees S and B shown below (single line denotes black pointer and double line red pointer): S: 2 B: 12 / \\ \\ 1 5 13 / \ 4 6 // \\ 3 7 (a) (25) Perform Join(S, 10, B) operation, showing each step. (b) (25) For the red-black tree S above, perform Split(3) , showing each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP 5536/AD 711R Advanced Data Structures Spring, 2001 Sample Solutions - Exam 2 1. (a) min | V -1-3-5-7-9-11-13-15-17-19- | | -------------------------- (b) DeleteMin min | V 3 19 / | \ (F)5 7(F) 11(F) | | \ (F)9 13(F) 15(F) | 17(F) (c) decrease 17 to 4 min | V 3 19 4 / | \ (F)5 7(F) 11(F) | | \ (F)9 13(F) 15(T) 2. treeNode FindKth (ibst, k) { if (ibst == null) return null; // not exist if (ibst->leftSize == k-1)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
return (ibst) // found else if (ibst->leftSize > k-1) // search left subtree return ( FindKth(ibst->leftChild, k)) else return ( FindKth(ibst->rightChild, k-(ibst->leftSize+1))); } Analysis: Clearly, the algorithm traverses a path from the root to the node containing the k-th smallest key or NULL, error, if k is out of range. In either case, the length if the path is O(h), where h is the height of the tree. 3. RL rotations Numbers in parentheses represents balance factors. (1) case 1: A (-1) A (-2) C (0) \ ==> \ ==> / \ B (0) B (1) (0) A B (0) / C (0) Before Insert C After (2) case 2: A(-1) A(-2) B(0):h+2 / \ / \ / \ h:Al C(0) ==> h:Al C(1) ==> (0)A C(-1) / \ / \ / \ / \ (0)B Cr:h (-1)B Cr:h Al Bl'Br Cr / \ / \ h h h-1 h h-1:Bl Br:h-1 h:Bl' Br:h-1 Before Insert to Bl After (3) case 3: A(-1) A(-2) B(0):h+2 / \ / \ / \ h:Al C(0) ==> h:Al C(1) ==> (1)A C(0)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
/ \ / \ / \ / \ (0)B Cr:h (-1)B Cr:h Al Bl Br' Cr / \ / \ h h-1 h h h-1:Bl Br:h-1 h-1:Bl Br':h Before Insert to Br After 4. (a) Insert 8 Insert 7 Insert 2 9 ==> 8,9 ==> 8 ==> 8 / \ / \ 7 9 2,7 9 Insert 6 6,8 Insert 1 6,8 Insert 4 6 ==> / | \ ==> / | \ ==> / \ 2 7 9 1,2 7 9 2 8 / \ / \ 1 4 7 9 Insert 3 6 ==> / \ 2 8 / \ / \ 1 3,4 7 9 (b) Delete 6 4 / \ 2 8 / \ / \ 1 3 7 9 5. (a) Numbers in parentheses represent ranks. i: Follow the right child pointer until rank(B) = rank(x), where rank(B) =1, x is a node pointer of tree S.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
ii: Combine subtree x, 10, and B 10 / \ 6 12 \\ \\ 7 13 iii: Combine the result of ii to node 5 through a red pointer 2 / \\ 1 5 / \\ 4 10 // / \ 3 6 12 \\ \\ 7 13 iv: Perform a RR rotation 5 // \\ 2 10 / \ / \ 1 4 6 12 // \\ \\ 3 7 13 (b) i: Search node 3 ii: Perform Join(B', 4, null) B': 4 iii: Join (B', 5, right-subtree of node 5) B': 5 / \ 4 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
\\ 7 iv: Join (left-subtree of node 2, 2, S') S': 1 \\ 2 Result: S X B 1 3 5 \\ / \ 2 4 6 \\ 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP 5536/AD 711R Advanced Data Structures Spring, 2001 Sample Solutions - Exam 2 1. (a) min | V -1-3-5-7-9-11-13-15-17-19- | | -------------------------- (b) RemoveMin min | V 3 19 / | \ (F)5 7(F) 11(F) | | \ (F)9 13(F) 15(F) | 17(F) (c) decrease 17 to 4 min | V 3 19 4 / | \ | (F)5 7(F) 11(T) 17(F) | | (F)9 13(F) 2. After RemoveMax 10 9 13 12 17
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
| / / | | 5 1 6 8 3 | | 2 4 Two passing combine Step 1: 9 13 17 / / / | | | 10 1 6 8 12 3 | | | 5 2 4 Step 2: 9 17 / / / | / | 10 1 6 8 13 3 | | | | 5 2 4 12 Step 3: 17 / / | 9 13 3 / / / | | 10 1 6 8 12 | | | 5 2 4 (b) 3. RL rotations Numbers in parentheses represents balance factors. (1) case 1: A (-1) A (-2) C (0) \ ==> \ ==> / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
B (0) B (1) (0) A B (0) / C (0) Before Insert C After (2) case 2: A(-1) A(-2) B(0):h+2 / \ / \ / \ h:Al C(0) ==> h:Al C(1) ==> (0)A C(-1) / \ / \ / \ / \ (0)B Cr:h (-1)B Cr:h Al Bl'Br Cr / \ / \ h h h-1 h h-1:Bl Br:h-1 h:Bl' Br:h-1 Before Insert to Bl After (3) case 3: A(-1) A(-2) B(0):h+2 / \ / \ / \ h:Al C(0) ==> h:Al C(1) ==> (1)A C(0) / \ / \ / \ / \ (0)B Cr:h (-1)B Cr:h Al Bl Br' Cr / \ / \ h h-1 h h h-1:Bl Br:h-1 h-1:Bl Br':h Before Insert to Br After 4. (a) Insert 8 Insert 7 Insert 2 9 ==> 8,9 ==> 8 ==> 8 / \ / \ 7 9 2,7 9 Insert 6 6,8 Insert 1 6,8 Insert 4 6 ==> / | \ ==> / | \ ==> / \ 2 7 9 1,2 7 9 2 8 / \ / \ 1 4 7 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Insert 3 6 ==> / \ 2 8 / \ / \ 1 3,4 7 9 (b) Delete 6 4 / \ 2 8 / \ / \ 1 3 7 9 5. (a) Lb1 rotation 2 / \\ 1 6 / \ 5 7 // 3 (b) Numbers in parentheses represent ranks. i: Follow the right child pointer until rank(B) = rank(x), where rank(B) =1, x is a node pointer of tree S. ii: Combine subtree x, 10, and B 10 / \ 6 12 \\ \\ 7 13 iii: Combine the result of ii to node 5 through a red pointer
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 / \\ 1 5 / \\ 4 10 // / \ 3 6 12 \\ \\ 7 13 iv: Perform a RR rotation 5 // \\ 2 10 / \ / \ 1 4 6 12 // \\ \\ 3 7 13 (c) i: Search node 3 ii: Perform Join(B', 4, null) B': 4 iii: Join (B', 5, right-subtree of node 5) B': 5 / \ 4 6 \\ 7 iv: Join (left-subtree of node 2, 2, S') S': 1 \\ 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Result: S X B 1 3 5 \\ / \ 2 4 6 \\ 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni Summer, 2005 Advanced Data Structures (AD 711R) Exam 02 CLOSED BOOK 80 Minutes Name: PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your name at the top of every exam sheet. 3. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 4. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 5. The points assigned to each question are provided in parentheses. 6. You may use only a pen or a pencil. No calculators allowed. 7. Do not write on the reverse side of the exam sheet. 8. Do not write close to the margins since those areas do not always make it through when faxed. 1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 1. (11) For the following min Fibonacci heap. (The ChildCut field is shown in parentheses; ChildCut is undefined for the root.) min | V 1 / | \ 14(T) 7(T) 9(F) / | | \ 8(T) 11(T) 10(T) 13(T) | 15(T) | \ 17(T) 19(T) | 21(T) Figure 1. Min Fibonacci heap (a) (5) For the min Fibonacci heap of figure 1, perform a DecreaseKey operation by changing 19 to 2. Draw the resulting min Fibonacci heap, clearly label ChildCut values. (b) (6) Perform a DeleteMin operation on the resulting Fibonacci heap of (a) , clearly label ChildCut values. 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary. 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 2. (11) Consider the following AVL tree. 50 / \ 30 70 / \ / \ 20 40 60 80 / \ / \ 35 65 75 85 \ 90 (a) (5) Delete key 40, show each step and specify each rotation type. (b) (6) Start with the original AVL tree(i.e., the tree before the deletion key 40) and insert 87 and 91 in this order. Show each step and specify each rotation type. 4
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary. 5
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 3. (12) For 2-3 trees, (a) (6) Insert the following sequence of keys: 9,8,7,2,6,1,4 and 3 into an initially empty 2-3 tree. Show each step. (b) (6) Delete the minimum key of the root node. Show each step. 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary. 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 4. (16) For red - black trees, use the bottom - up algorithm for this problem. Double lines indicate a red edge and single line a black edge. (a) (8) Insert 6,10,1 and 2 in sequence into the following red-black tree. 5 / \ 3 8 // 7 (b) (8) Consider the red-black tree below. Perform Split(3) operation, showing each step. 2 / \\ 1 5 / \ 4 6 // \\ 3 7 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary. 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Exam02_solution Summer , 2005 question 1. DecreaseKey operation by changing 9 by 2 min | V 1 ----------------------2 / \ | 4(F) 12(T) 11(T) / | / \ 10(T) 5(T) 15(F) 19(T) / 17(F) | 21(T) DeleteMin operation. min | V 4(F) 2 / | \ | 10(T) 5(T) 12(F) 11(T) / / \ 17(F) 15(F) 19(T) | 21(T) 2) insert 8 (LR) 10 (2) / \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
5 12 / \ / \ 3 7 11 13 / \ / \ 2 4 6 9 / 8 7(0) / \ 5(1) 10 / \ / \ 3 6 9(1) 12 / \ / / \ 2 4 8 11 13 insert 1 (LL) 7(0) / \ 3(0) 10 / \ / \ 2(1) 5 9(1) 12 / / \ / / \ 1 4 6 8 11 13 3) (a) tree with smaller root becomes leftmost subtree. Insert7 Insert 1 Insert 2 3 ==> 7 ==> 7 ==> 7 | / | / / | 3 1 3 2 1 3 Insert 8 Insert 9 Insert 12 ==> 8 ==> 9 ==> 12 | | | 7 8 9 / / | | | 2 1 3 7 8 / / | |
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 1 3 7 / / | 2 1 3 Insert 10 =======> 12 / | 10 9 | 8 | 7 / / | 2 1 3 (b) 12 17 meld two heaps 17 / | / / | ========> / / / | 10 9 2 1 3 12 2 1 3 | / | 8 10 9 | 8 (c) two-pass meld after remove min pass 1: start subtrees left to right. 18 15 9 17 | | | 11 10 7 the number of subtrees was odd, meld remaining original subtree with newly generated subtree. 18 15 17 | | | 11 10 9 | 7 Pass 2: start with rightmost subtrees of pass 1 17 18 / | step2 / | 15 9 ===> 17 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
| | / | 10 7 15 9 | | 10 7 (4) (a) I(7) 2 RRr 2 I(6) 2 ===> // \\ ===> / \ ===> / \ 1 5 1 5 1 5 \\ \\ \\ 7 7 7 // 6 2 2 RLb / \ I(4) / \ ===> 1 6 ===> 1 6 // \\ // \\ 5 7 5 7 // 4 2 2 LLr / \\ I(3) / \\ ==> 1 6 ===> 1 6 / \ / \ 5 7 5 7 // // 4 4 // 3 2 LLb / \\ ==> 1 6 / \ 4 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
// \\ 3 5 (b) if red node is deleted, then no rebalancing needed delete 14 10 / \\ 8 13 // \\ / \ 7 9 12 15 // 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni Summer, 2011 Advanced Data Structures (COP5536) Exam 02 CLOSED BOOK 70 Minutes Name : UFID: PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on the exam question sheet. You may use scrap paper for work, but these will not be graded. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. The points assigned to each question are provided in parentheses. 5. You may use only a pen or a pencil. No calculators allowed. 6. Do not write on the reverse side of the exam sheet. 7. Do not write close to the margins since those areas do not always make it through when faxed.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 1 (12 points) Given the following 4 key values and their search probabilities, design the optimal binary search tree by filling the weights, costs and roots tables. Keys’ Values 1 2 3 4 Probabilities for Keys (p i ) 20% 15% 5% 35% We also assume the probabilities of every search failure cases (q i ) are 5%, respectively. Weights Table (3 Points) 0 1 2 3 4 0 1 2 3 4 Costs Table (6 Points) 0 1 2 3 4 0 1 2 3 4 Roots Table (3 Points) 0 1 2 3 4 0 1 2 3 4
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 2 (10 points) (1) For the AVL tree below, what is the result AVL tree after we remove the element 35? (5 Points)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(2) What is result AVL tree after we insert the element 17 into the AVL tree below? (5 Points)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 3 (12 points) This question deals with red black trees. A double edge indicates a red pointer and single edge indicates a black pointer. (1) Construct a red black tree by inserting the keys in the following sequence into an initially empty red black tree: 13, 10, 8, 3, 4 and 9. Show each step. (6 points)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(2) For the red black trees in the following figure, perform Join (S, 5, B) operation and show each step. (6 points)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 4 (16 points) (1) Given the following B tree of order m = 5, show each corresponding B tree after insertion of 17, 6, 21, 67, in this order. Use commas (,) to separate the data in a node. (8 points)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(2) Given the following B tree of order m = 4, show each corresponding B tree after deletion of 90, 92, 75, 60, in this order. Use commas (,) to separate the data in a node. (8 points)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 1 (12 points) Given the following 4 key values and their search probabilities, design the optimal binary search tree by filling the weights, costs and roots tables. Keys’ Values 1 2 3 4 Probabilities for Keys (p i ) 20% 15% 5% 35% We also assume the probabilities of every search failure cases (q i ) are 5%, respectively. Weights Table (3 Points) 0 1 2 3 4 0 5 30 50 60 100 1 5 25 35 75 2 5 15 55 3 5 45 4 5 Costs Table (6 Points) 0 1 2 3 4 0 0 30 75 105 200 1 0 25 50 125 2 0 15 70 3 0 45 4 0 Roots Table (3 Points) 0 1 2 3 4 0 0 1 1 2 2 1 0 2 2 4 2 0 3 4 3 0 4 4 0
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 2 (10 points) (1) For the AVL tree below, what is the result AVL tree after we remove the element 35? (5 Points) Answer: After we remove 35, the result AVL tree is like below:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(2) What is result AVL tree after we insert the element 17 into the AVL tree below? (5 Points) Answer : After inserting element 17, the result AVL tree is like below:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 3 (12 points) This question deals with red black trees. A double edge indicates a red pointer and single edge indicates a black pointer. (1) Construct a red black tree by inserting the keys in the following sequence into an initially empty red black tree: 13, 10, 8, 3, 4 and 9. Show each step. (6 points) Answer:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(2) For the red black trees in the following figure, perform Join (S, 5, B) operation and show each step. (6 points) Answer:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 4 (16 points) (1) Given the following B tree of order m = 5, show each corresponding B tree after insertion of 17, 6, 21, 67, in this order. Use commas (,) to separate the data in a node. (8 points) Answer:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(2) Given the following B tree of order m = 4, show each corresponding B tree after deletion of 90, 92, 75, 60, in this order. Use commas (,) to separate the data in a node. (8 points) Answer:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni Summer 2012 Advanced Data Structures (COP 5536) Exam 2 CLOSED BOOK 60 Minutes Name: UFID: PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your name at the top of every exam sheet. 3. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 4. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 5. The points assigned to each question are provided in parentheses. 6. You may use only a pen or a pencil. No calculators allowed. 7. Do not write on the reverse side of the exam sheet. 8. Do not write close to the margins since those areas do not always make it through when faxed.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 1. (10 points) For the following min Fibonacci heap, assume that the ChildCut field of all nodes is TRUE. min | V 2-----------------10-------------20 / | \ | \ 4 5 6 11 12 | \ | 7 8 13 | 9 Figure 1. Min Fibonacci heap (a) (5) For the min Fibonacci heap of figure 1, perform a DecreaseKey operation by changing 8 to 1. Draw the resulting min Fibonacci heap, clearly label ChildCut values. (b) (5) Perform a Delete 10 operation on the resulting Fibonacci heap of (a) , clearly label ChildCut values. (Show each step)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 2. (10 points) Start with an empty two - pass min pairing heap, (a) (5 points) Insert the following sequence of keys: 5, 8, 4, 12, 3, 14, 20, 15 and 9. Show the pairing heap after each insert. (b) (5 points) Perform a RemoveMin operation on the result min heap of (a), show each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 3. (10 points) Start with an empty AVL tree, and perform insert operations using the follow- ing sequence of keys: 1, 3, 7, 6, 4, 5, and 2. Show each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 4. (10 points) For the following red-black trees (double links are red links), S: 2 B: 9 / \\ // 1 5 10 / \ 3 6 \\ \\ 4 7 (a) (5)Perform Join ( S, 8 , B ), show each step. (b) (5) Split the tree S with respect to 3, show each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 5. (10 points) The following tree represents a 234-tree. 24 / \ (2 , 22) (30 , 40, 48) / | \ / | | \ 1 (5,11,19) 23 29 (32,36) (41,42,43) 50 (a) (5 points) Draw a picture of the 234-tree that results from inserting 31 into the original 234-tree. (b) (5 points) Draw a picture of the 234-tree that results from deleting 24 from the original 234-tree.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. (a) min 2 6 1 10 20 / \ | | | \ (T)4 5(T) 7(T) 9(T) 11(T)12(T) | 13(T) (b) The below solution is right answer for (b). (5:full points answer) delete operation didn’t join(or combine) steps except Deletemin operation) min 2 6 1 11 12(T) 20 / \ | | | (T)4 5(T) 7(T) 9(T) 13(T) 2. (a) Insert 8 Insert 4 Insert 12 5 ==> 5 ==> 4 ==> 4 | | / \ 8 5 12 5 | | 8 8 Insert 3 Insert 14 Insert 20 ==> 3 ==> 3 ==> 3 | / \ / | \ 4 14 4 20 14 4 / \ / \ / \ 12 5 12 5 12 5 | | | 8 8 8 Insert 15 Insert 9 ==> 3 ==> 3 / / | \ / / / | \ 15 20 14 4 9 15 20 14 4 / \ / \ 12 5 12 5 | | 8 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(b) two-pass meld after remove min 9 15 20 14 4 / \ 12 5 | 8 ==> 9 14 4 | | / \ 15 20 12 5 | 8 ==> 4 / / | \ 9 14 12 5 | | | 15 20 8 3. rotations : RR - > LL - > RL - > LR 4 / \ 2 6 / \ / \ 1 3 5 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4. (a) merge (6,8,9) followed by RRb rotation. 5 // \\ 2 8 / \ / \ 1 3 6 9 \\ \\ // 4 7 10 (b) S x B 1 3 5 \\ / \ 2 4 6 \\ 7 5. (a) 24 / \ 2 , 22 30 , 40, 48 / | \ / | \ \ 1 5,11,19 23 29 31,32,36 41,42,43 50 (b) 29 / \ 2 , 22 32 , 40 , 48 / | \ / / \ \ 1 5,11,19 23 30 36 41,42,43 50
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 8 COP 5536 Advanced Data Structures Exam 2 CLOSED BOOK 6 0 Minutes PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class. 2. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Note. The points assigned to each question are provided in parentheses. Last Name: _______________ First Name: _______________ UFID: _______________ https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 8 1. (15) (a) [8 points] For the min Fibonacci heap shown below, perform a DecreaseKey operation by changing 19 to 2. Draw the resulting min Fibonacci heap, clearly label ChildCut values. (The ChildCut field is shown in parentheses; ChildCut is undefined for the root.) min | v 1 / | \ 14(T) 7(T) 9(F) / | | \ 8(T) 11(T) 10(T) 13(T) | 15(T) | \ 17(T) 19(T) | 21(T) (b) [7 points] Perform a DeleteMin operation on the resulting Fibonacci heap of (a), clearly label ChildCut values. https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 8 https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 8 2. (10): a) [5 points] With an initially empty two-­‐pass min pairing heap , insert the following keys in sequence: 9,7,6,8,1,2,3,4 and 5 (show each step). b) [5 points] Perform DeleteMin on the resulting tree of part a (use the two-­‐pass scheme and show each step) Solution: Basic rule: tree with larger root becomes the left-most subtree Step1: remove node 1. Step2(1 st pass): we meld from left to right; if the number of subtrees is odd, meld remaining original subtree with newly generated ones. Step3(2 nd pass): start from right most, meld all. https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 8 3. (10) Consider the following AVL tree. 40 / \ 20 60 / \ / \ 10 30 50 70 / \ / \ 25 55 65 75 \ 80 (a) [5 points] Delete key 30, show each step and specify each rotation type. (b) [5 points] Start with the original AVL tree (i.e., the tree before the deletion key 30) and insert 77 and 81 in this order. Show each step and specify each rotation type. https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 8 https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 8 4. (15): a) [10 points] Construct a Red-­‐Black tree by inserting 13,10,8,3,4 and 9 in sequence, use a double-­‐edge to indicate a red pointer and a single-­‐edge to indicate a black pointer (show each step). b) [5 points] Perform Join(S,5,B) on the following Red-­‐Black trees (show each step). Solution: https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 8 of 8 https://www.coursehero.com/file/16469413/Exam2-solpdf/ This study resource was shared via CourseHero.com Powered by TCPDF (www.tcpdf.org)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP5536 Advanced Data Structures Exam 2 Closed Book Duration: 60 mins Prof. Sartaj Sahni PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Last name: First name: UFID:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 8 Problem 1 (12) (a) (6)Drawn below is a min Fibonacci heap (The ChildCut field is shown in parentheses): 3(min) -----------------15 / | \ 4(F) 6(T) 5 (T) / \ | \ (T)8 7(F) 12(T) 7(T) | | (T)10 11(F) / | | (F)11 17(T) 13(T) | 20(T) Perform a DecreaseKey operation by changing 17 to 4. Solution: DecreaseKey operation by changing 17 by 4 min | V 3 15 4 10 8 / / \ | | 4(T) 6(T) 5(T) 20(T) 11(F) | / | 7(F) 12(T) 7(T) | 11(F) | 13(T)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 8 (b) (6) For the following min Fibonnaci heap , assume that the ChildCut field of each node is True. 3(min) -----------------5--------------17 / | \ / \ | 6 7 9 13 15 24 / \ 12 13 | 14 Perform DeleteMin operation on the Fibonnaci heap, clearly labeling the ChildCut value of each node. Show each step. Solution: After deleteMin operation, we need to combine steps like below: 6 degree 1 6 | ===> / | degree 2 7(F) 7(F) 17(F) ======> | 24(T) min 5 --------------- 9 / | \ / \ (T)13 (T)15 6(F) (T)12 13(T) | \ | 7(F) 17(F) 14(T) | 24(T) This can have differnt other correct versions as well.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 8 Problem 2 (10) Consider the following AVL tree. 40 / \ 20 60 / \ / \ 10 30 50 70 / \ / \ 25 55 65 75 \ 80 1. (5) Delete key 30, show each step and specify each rotation type. Solution: delete 30 delete 30 40 (2) RR rotation --> 60 / \ / \ 20 60 40 70 / \ / \ / \ / \ 10 25 50 70 20 50 65 75 \ / \ / \ \ \ 55 65 75 10 25 55 80 \ 80 2. (5) Start with the original AVL tree(i.e., the tree before the deletion key 30) and insert 77 and 81 in this order. Show each step and specify each rotation type. Solution: After inserting 77 ( RL rotation is required)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 8 40 / \ 20 60 / \ / \ 10 30 50 70 / \ / \ 25 55 65 77 / \ 75 80 after inserting 81 ( RR rotation is required) 40 / \ 20 60 / \ / \ 10 30 50 77 / \ / \ 25 55 70 80 / \ \ 65 75 81
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 8 Problem 3 (12) (a) (6) Construct a red-black tree by inserting the following sequence of keys : 6,11,3,15,13,9 and 7. Use the bottom-up algorithm, show each step. The tree is initially empty. Solution: 6 6 6 // \\ insert 15 / \ insert 13 / \ insert 9 3 11 -----> 3 11 -------> 3 13 --------> \\ //\\ 15 11 15 6 6 / \\ insert 7 / \\ 3 13 --------> 3 13 / \ / \ 11 15 9 15 // // \\ 9 7 11 (b) (6) For the following red-black tree, (each node is labelled as either black or red in paranthesis near to the node) 8(B) / \ 5(B) 15(R) / \ 11(B) 17(B) / \ 9(R) 13(R) perform the Delete operation for key value 17, showing each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 8 Solution: 8 -------> / \\ 5 13 / \ 11 15 // 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 8 Problem 4 (16) (a) (6) Suppose that n keys are inserted into an empty B-tree of order m. What is the maximum height h in terms of n and m in the final B-tree? Show how you derive your answer. Solution: (b) (5) Given the following 5-way B + -tree, insert 50 and 90 in the given order. Show each step and the resulting tree. Solution:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 8 of 8 (c) (5) For the following 2-3 tree, Delete the root node (Node which key value = 8), showing each step. Solution: Delete 8 7 / \ 4 10 / \ / \ 3 5 9 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP5536 Advanced Data Structures Exam 2 Closed Book Duration: 60 mins Prof. Sartaj Sahni PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Last name: First name: UFID:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 7 Problem 1 (12) (a) (6) Drawn below is a min Fibonacci heap (Assume that ChildCut field of all nodes are TRUE): 3---------- 1--------------20 / | \ / \ 4 5 6 11 12 / \ | 7 8 13 | 9 Perform a DecreaseKey operation by changing 8 to 2,clearly labeling the ChildCut value of each node. (b) (6) Perform DeleteMin operation on the original Fibonnaci heap(before decrease key 8), clearly labeling the ChildCut value of each node. Show each step. Solution: part a: Min 3 6 2 1 20 / \ | | / | (T) 4 5(T) 7(T) 9(T) (T)11 12(T) | 13(T)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 7 part b: 3 11 / | \ / \ 4 5 6 12 20 / \ | 7 8 13 | 9 Problem 2 (10) Consider the following AVL tree. 11 / \ 7 20 / \ / \ 3 9 14 32 / \ / \ / \ 1 4 12 17 27 37 / 25 1. (5) Delete key 9, show each step and specify each rotation type. Solution: 11 / \ (2) 7 20 / / \ 3 14 32 / \ / \ / \ 1 4 12 17 27 37 / 25
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 7 R0 rotation: 11 (-2) / \ (0) 3 20 (-1) / \ / \ 1 7 14 32 (1) / / \ / \ 4 12 17 27 37 / 25 2. (5) Start with the original AVL tree( i.e. the tree before the deletion key 9 ) and insert 26 and 29 in this order. Show each step and specify each rotation type. 11 / \ 7 20 / \ / \ 3 9 14 32 / \ / \ / \ 1 4 12 17 27 37 / 25 \ 26 LR rotation:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 7 11 / \ 7 20 / \ / \ 3 9 14 32 / \ / \ / \ 1 4 12 17 26 37 / \ 25 27 Insert 29: 11 / \ 7 20 / \ / \ 3 9 14 32 / \ / \ / \ 1 4 12 17 26 37 / \ 25 27 \ 29 LR rotation: 11 / \ 7 20 / \ / \ 3 9 14 27 / \ / \ / \ 1 4 12 17 26 32 / / \ 25 29 37
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 7 Problem 3 (12) Consider the following splay tree: p / m / k / c \ j / d 1. (6)Perform a search for element d under the assumption this is a Top down splay tree. 2. (6) Do previous part assuming a bottom-up splay tree. Solution: part a: B S d m c / \ k p / j part b: d / \ c p / k / \ j m
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 7 Problem 4 (16) (a) (6) Suppose that n keys are inserted into an empty B-tree of order m. What is the maximum height h in terms of n and m in the final B-tree? Show how you derive your answer. (b) (10) Draw a 2-3 tree with 11 elements (keys from 1 to 11) and height 3, where all nodes at levels 2 and 3 are 2-nodes (the root is at level 1). Delete the element in the rightmost node at level 2 and draw the resulting 2-3 tree. From the resulting tree , delete the min element. Draw the new 2-3 tree. solution: part a: final Answer= 1 + log n +1 / 2 d m/ 2 e Derivation1: because number of keys +1 is equal to the total number of external nodes. n + 1 = 2 d m/ 2 e h - 1 so h is equal to 1 + log n +1 / 2 d m/ 2 e . Derivation 2: n = 1 + 2( d m/ 2 e - 1) + 2 d m/ 2 e ( d m/ 2 e - 1) + ... + 2 d m/ 2 e 2( h - 2) ( d m/ 2 e - 1) = 1 + 2( d m/ 2 e - 1)( d m/ 2 e h - 2 - 1) / ( d m/ 2 e - 1) = 2 d m/ 2 e h - 1 - 1 therefore h is equal to the 1 + log n +1 / 2 d m/ 2 e . Part b: (4, 8) / | \ 2 6 10 / \ / \ / \ 1 3 5 7 9 11 After delete 10:First, transform deletion from interior to deletion from a leaf. 4, 8 / | \ 2 6 9 / \ / \ / \ 1 3 5 7 ( ) 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 7 4, 8 / | \ ===> 2 6 ( ) / \ / \ | 1 3 5 7 9,11 4 / \ ===> 2 6,8 / \ / | \ 1 3 5 7 9,11 Then delete 1(min element): 4 / \ 2 6,8 / \ / | \ () 3 5 7 9,11 4 / \ ===> ( ) 6,8 | / | \ 2,3 5 7 9,11 6 / \ ===> 4 8 / \ / \ 2,3 5 7 9,11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 8 COP 5536 Advanced Data Structures Spring 2018 Exam 2 Solutions
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 8 Question.1 (12): Start with an empty AVL tree and perform insert operations using the following sequence of keys: 21, 23, 27, 26, 24, 25, and 22. Show each step. rotations : RR (3 points) -> LL (3 points) -> RL (3 points) -> LR (3 points) 24 / \ 22 26 / \ / \ 21 23 25 27
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 8 Question 2 (12): For the following red-black trees (double links are red links), S: 2 B: 12 / \\ \\ 1 5 13 / \ 4 6 // \\ 3 7 (a) (6) Consider the red-black tree above. Perform delete (4) operation for red-black tree S, showing each step. (b) (6) Perform Join (S; 10; B) on the ORIGINAL red-black trees in the above figure, showing each step. (a) After Delete 4 (6 points Marks are given for partially correct answer) 2 / \\ 1 5 / \ 3 6 \\ 7 (b) Numbers in parentheses represent ranks. i: Follow the right child pointer until rank(B) = rank(x), where rank(B) =1, x is a node pointer of tree S. ii: Combine subtree x, 10, and B (1 Point) 10 / \ 6 12 \\ \\ 7 13
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 8 iii: Combine the result of ii to node 5 through a red pointer (3 Points) 2 / \\ 1 5 / \\ 4 10 // / \ 3 6 12 \\ \\ 7 13 iv: Perform a RR rotation (2 Points) 5 // \\ 2 10 / \ / \ 1 4 6 12 // \\ \\ 3 7 13
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 8 Question 3 (12): (a) (6) Suppose that n keys are inserted into an empty B-tree of order m. What is the maximum height h in terms of n and m in the final B-tree? Show how you derive your answer. (b) (6) Given the following 5-way B+-tree, insert 40 and 100 in this order. Show each step and the resulting tree. (a) formulated problem correctly based on correct B-tree defition : 3 Correct final answer and derivation: 3 (b) for each correct insertion : 3 points for each minor mistake -1 if used incorrect insert algorithm : no point
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 8 Insert 100
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 8 Question 4 (14): (a) (7) Insert the following keys into an initially empty instance of a splay tree, assuming that this is a bottom-up splay tree: 4, 1, 5, 9, 3, 8, 2 (b) (7) Consider the following top-down splay tree: Perform a split operation with respect to the node with the key 5, showing each step (a) did not splay for each insert : 1 or no points perform correct splay operations for each insert and arrive at correct solution : 7 each splay error : -2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 8 of 8 (b) if knows the tree has to be divided in two parts : 2 performed splay at a correct point in a correct way : 3 splay operations has no mistake : 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 6 COP 5536 Advanced Data Structures Fall 2020 Exam 2 CLOSED BOOK 7:30 pm 9:00 pm (60 Minutes + Extra 30 Minutes for scanning & submission) PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on your own white blank paper. You may use extra scratch paper for calculation, but these will not be submitted. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Note. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses. Last Name: _____________ First Name: _______________ UFID: _______________ Q. 1 (12) Q. 2 (14) Q. 3 (12) Q. 4 (12) Total (50)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 6 Question 1 (12): (a) (6) Drawn below is a min Fibonacci heap (Assume that ChildCut field of all nodes are TRUE): 3 ------------ 1 -------------- 20 / | \ / \ 4 5 6 11 12 / \ | 7 8 13 | 9 Perform a DecreaseKey operation by changing 8 to 2, clearly labeling the ChildCut value of each node. (b) (6) Perform DeleteMin operation on the original Fibonnaci heap (before decreasing key 8 int part a), clearly label the ChildCut value of each node. Show each step. Solution ( 4 pts for correct result + 2 pts for correct ChildCut labeling each part ) (a) . (b) . (F) (F)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 6 Question 2 (14): a) (8) With an initially empty two- ‐pass min pairing heap, insert the following keys in sequence: 9, 7, 6, 8, 1, 2, 3, 4 and 5 (show each step). b) (6) Perform DeleteMin on the resulting tree of part a (use the two-pass schemeand show each step) Solution: a) (8) Basic rule: tree with larger root becomes the left-most subtree ( 1pt per step ) b) (2 pts per step) Step 1 : remove min node 1 Step 2 (1 st pass) : we meld from left to right; if the number of subtrees is odd, meld remaining original subtree with newly generated ones. Step 3 (2 nd pass) : start from the right most, meld all.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 6 Question 3 (12): Consider the following splay tree: a. (6) Perform a search for element d under the assumption this is a Top down splay tree. b. (6) Do previous part assuming a bottom-up splay tree. Solution (part a : 3 pts for B and 3pts for S; part b deduct 2 pts if the Rotations are wrong))
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 6 Question 4 (12): A 2-3-4-Tree is given below. a. (6) Insert 6 and then insert 5 into the above tree. Draw the tree following each insert. b. (6) Delete node 24 from the resulting tree of (a). Show the final tree after deletion. Solution : (3 pts for the result after each insertion in part a. for part b, full credits are also given if you combined 30 and 33. )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 3 COP 5536 Advanced Data Structures Spring 2021 Exam 2 CLOSED BOOK 9:00 am 10:30 am (60 Minutes + Extra 30 Minutes for scanning & submission) PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on your own white blank paper. You may use extra scratch paper for calculation, but these will not be submitted. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Note. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses. Last Name: _____________ First Name: _______________ UFID: _______________ Q. 1 (10) Q. 2 (12) Q. 3 (14) Q. 4 (14) Total (50)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 3 Question 1 (10): For the following min Fibonacci heap, assume that the ChildCut field of all nodes is TRUE. (a). (4) Perform DecreaseKey operation by changing 11 to 2. Show the result. (b). (6) Perform DeleteMin operation on the resulting Fibonacci heap from (a), clearly label the ChildCut value. Show the result. Question 2 (12): Start with an empty two-pass MIN pairing heap, (a). (6) Insert the following sequence of keys: 35, 48, 24, 52, 13, 54, 60, 55, 19. Show the pairing heap after each insert. (b). (6) Perform a RemoveMin operation on the resultant min heap from (a). Show steps.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 3 Question 3 (14): Start with an empty AVL tree and perform insert operations using the following sequence of keys: 19, 23, 28, 26, 24, 25, and 20. Show each step and degree at each step. Question 4 (14): For the following red-black trees (double links are red links), (a). (6) Perform delete (14) operation for red-black tree S, showing each step. (b). (8) Perform Join (S; 20; B) on the ORIGINAL red-black trees in the above figure, showing each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 8 COP 5536 Advanced Data Structures Spring 2021 Exam 2 CLOSED BOOK 9:00 am 10:30 am (60 Minutes + Extra 30 Minutes for scanning & submission) PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on your own white blank paper. You may use extra scratch paper for calculation, but these will not be submitted. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Note. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses. Last Name: _____________ First Name: _______________ UFID: _______________ Q. 1 (10) Q. 2 (12) Q. 3 (14) Q. 4 (14) Total (50)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 8 Question 1 (10): For the following min Fibonacci heap, assume that the ChildCut field of all nodes is TRUE. (a) (4) Perform DecreaseKey operation by changing 11 to 2. Show the result. (b) (6) Perform DeleteMin operation on the resulting Fibonacci heap from (a), clearly label the ChildCut value. Show the result. Solution : (a) Correct results(2pts), draw ChildCut and links (2pts) (b) Correct results(4pts), ChildCut value(2pts)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 8 Question 2 (12): Start with an empty two-pass MIN pairing heap, (a). (6) Insert the following sequence of keys: 35, 48, 24, 52, 13, 54, 60, 55, 19. Show the pairing heap after each insert. (b). (6) Perform a RemoveMin operation on the resultant min heap from (a). Show steps.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 8 Question 3 (14): Start with an empty AVL tree and perform insert operations using the following sequence of keys: 19, 23, 28, 26, 24, 25, and 20. Show each step and degree at each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 8 Question 4 (14): For the following red-black trees (double links are red links),
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 8 (a). (7) Consider the red-black tree above. Perform delete (14) operation for red-black tree S, showing each step. (b). (7) Perform Join (S; 20; B) on the ORIGINAL red-black trees in the above figure, showing each step
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 8 of 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni Summer 2012 Advanced Data Structures (COP 5536) Exam 2 CLOSED BOOK 60 Minutes Name: UFID: PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your name at the top of every exam sheet. 3. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 4. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 5. The points assigned to each question are provided in parentheses. 6. You may use only a pen or a pencil. No calculators allowed. 7. Do not write on the reverse side of the exam sheet. 8. Do not write close to the margins since those areas do not always make it through when faxed.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 1. (10 points) For the following min Fibonacci heap, assume that the ChildCut field of all nodes is TRUE. min | V 2-----------------10-------------20 / | \ | \ 4 5 6 11 12 | \ | 7 8 13 | 9 Figure 1. Min Fibonacci heap (a) (5) For the min Fibonacci heap of figure 1, perform a DecreaseKey operation by changing 8 to 1. Draw the resulting min Fibonacci heap, clearly label ChildCut values. (b) (5) Perform a Delete 10 operation on the resulting Fibonacci heap of (a) , clearly label ChildCut values. (Show each step)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 2. (10 points) Start with an empty two - pass min pairing heap, (a) (5 points) Insert the following sequence of keys: 5, 8, 4, 12, 3, 14, 20, 15 and 9. Show the pairing heap after each insert. (b) (5 points) Perform a RemoveMin operation on the result min heap of (a), show each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 3. (10 points) Start with an empty AVL tree, and perform insert operations using the follow- ing sequence of keys: 1, 3, 7, 6, 4, 5, and 2. Show each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 4. (10 points) For the following red-black trees (double links are red links), S: 2 B: 9 / \\ // 1 5 10 / \ 3 6 \\ \\ 4 7 (a) (5)Perform Join ( S, 8 , B ), show each step. (b) (5) Split the tree S with respect to 3, show each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 5. (10 points) The following tree represents a 234-tree. 24 / \ (2 , 22) (30 , 40, 48) / | \ / | | \ 1 (5,11,19) 23 29 (32,36) (41,42,43) 50 (a) (5 points) Draw a picture of the 234-tree that results from inserting 31 into the original 234-tree. (b) (5 points) Draw a picture of the 234-tree that results from deleting 24 from the original 234-tree.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1. (a) min 2 6 1 10 20 / \ | | | \ (T)4 5(T) 7(T) 9(T) 11(T)12(T) | 13(T) (b) The below solution is right answer for (b). (5:full points answer) delete operation didn’t join(or combine) steps except Deletemin operation) min 2 6 1 11 12(T) 20 / \ | | | (T)4 5(T) 7(T) 9(T) 13(T) 2. (a) Insert 8 Insert 4 Insert 12 5 ==> 5 ==> 4 ==> 4 | | / \ 8 5 12 5 | | 8 8 Insert 3 Insert 14 Insert 20 ==> 3 ==> 3 ==> 3 | / \ / | \ 4 14 4 20 14 4 / \ / \ / \ 12 5 12 5 12 5 | | | 8 8 8 Insert 15 Insert 9 ==> 3 ==> 3 / / | \ / / / | \ 15 20 14 4 9 15 20 14 4 / \ / \ 12 5 12 5 | | 8 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(b) two-pass meld after remove min 9 15 20 14 4 / \ 12 5 | 8 ==> 9 14 4 | | / \ 15 20 12 5 | 8 ==> 4 / / | \ 9 14 12 5 | | | 15 20 8 3. rotations : RR - > LL - > RL - > LR 4 / \ 2 6 / \ / \ 1 3 5 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4. (a) merge (6,8,9) followed by RRb rotation. 5 // \\ 2 8 / \ / \ 1 3 6 9 \\ \\ // 4 7 10 (b) S x B 1 3 5 \\ / \ 2 4 6 \\ 7 5. (a) 24 / \ 2 , 22 30 , 40, 48 / | \ / | \ \ 1 5,11,19 23 29 31,32,36 41,42,43 50 (b) 29 / \ 2 , 22 32 , 40 , 48 / | \ / / \ \ 1 5,11,19 23 30 36 41,42,43 50
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP5536 Advanced Data Structures Exam 2 Prof. Sartaj Sahni Last name: First name: UFID:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP5536 - Exam 2 Page 1 of 4 Problem 1 (12) (a) (5) For the min Fibonacci heap of figure below, perform a DecreaseKey operation by changing 19 to 2. Draw the resulting min Fibonacci heap, clearly label ChildCut values. (The ChildCut field is shown in parentheses; ChildCut is undefined for the root.) min | V 1 / | \ 14(T) 7(T) 9(F) / | | \ 8(T) 11(T) 10(T) 13(T) | 15(T) | \ 17(T) 19(T) | 21(T) (b) (6) Perform a DeleteMin operation on the resulting Fibonacci heap of (a) , clearly label ChildCut values.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP5536 - Exam 2 Page 2 of 4 Problem 2 (12) (a) (6) Insert the following sequence of keys: 2, 5, 8, 4, 7, 12, 3 and 9 in this order in an empty max pairing heap . Show each step. (b) (6) For the max pairing heap given below, perform a RemoveMax operation using two-pass scheme and show each step. 15 / / / | \ \ \ 10 13 12 11 5 9 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP5536 - Exam 2 Page 3 of 4 Problem 3 (14) (a) (7) Insert the keys 6,3,11,7,8,5,1,2,4,9,10 and 12, one by one in this order into an initially empty 2-3-Tree (i.e., B-tree of order 3). Show the tree after each insert. (b) (7) Delete the keys 12,7,2,5,1 and 11, in this order, from the tree constructed in part (a). Show the tree after each delete.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
COP5536 - Exam 2 Page 4 of 4 Problem 4 (12) Perform a Split operation using the split key 6 in the following bottom-up splay tree. Show each Step. 18 / \ 8 20 / \ \ 4 10 22 / \ / \ \ 2 6 9 15 30 / \ / \ 5 7 11 17
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
1a) DecreaseKey operation by changing 10 by 2 min | V 1-----------------2--------15-----13 / | \ | | 14(T) 7(T) 9(T) 21(T) 17(T) / | | 8(T) 11(T) 10(T) b)DeleteMin operation. 2----------------------------13 / | \ | \ 7(F) 9(F) 21(T) 14(F) 15(F) / | | | 8(T) 11(T) 10(T) 17(T) Grading policy: Due to different permutations of trees in (a), other solutions are possible in (b). The pairwise combine should follow the order of resulting trees obtained from (a), and then use a table to keep track of the trees by degrees. If you have not followed the order, 3-5 marks are deducted depend on your answer. 2) (a) tree with smaller root becomes leftmost subtree. Insert 5 Insert 8 Insert 4 2 ==> 5 ==> 8 ==> 8 | | / \ 2 5 4 5 | | 2 2 Insert 7 Insert 12 Insert 3 ==> 8 ==> 12 ==> 12 / | \ | / | 7 4 5 8 3 8 | / | \ / | \ 2 7 4 5 7 4 5 | | 2 2 Insert 9 =======> 12 / | \
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
9 3 8 / | \ 7 4 5 | 2 (b) two-pass meld after remove min pass 1: start subtrees left to right. 13 12 9 7 | | | 10 11 5 the number of subtrees was odd, meld remaining original subtree with newly generated subtree. 13 12 9 | | / | 10 11 7 5 Pass 2: start with rightmost subtrees of pass 1 12 13 / | step2 / | 9 11 ===> 12 10 / | / | 7 5 9 11 / | 7 5 Grading policy: (b)According to the two-pass scheme, firstly meld pairs of subtrees from left to right, if the number of subtrees is odd, meld the remaining original subtree with last newly generated subtree. If you have not used this scheme, marks are deducted. Then start from the rightmost subtree, meld remaining subtrees from right to left. If you did it from left to right, marks are deducted. 3)a) 6 / \ . 3 8,10 . / \ / | \ 1,2 4,5 7 9 11,12 b) 6,9 / | \ . 3,4 8 10 Grading Policy: Marks are deducted for incorrect steps.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4) 6 / \ . 4 18 . / \ / \ 2 5 8 20 / \ \ 7 10 22 / \ \ 9 15 30 / \ 11 17 Grading policy: If you have not used the standard bottom up technique, 4 marks are deducted. Marks are also deducted if steps are not shown.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 9 COP 5536 Advanced Data Structures Spring 2018 Exam 2 CLOSED BOOK 60 Minutes PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Note. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses. Last Name: _______________ First Name: _______________ UFID: _______________ Q. 1 (12) Q. 2 (12) Q. 3 (12) Q. 4 (14) Total (50)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 9 Question.1 (12): Start with an empty AVL tree and perform insert operations using the following sequence of keys: 21, 23, 27, 26, 24, 25, and 22. Show each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 9 Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 9 Question 2 (12): For the following red-black trees (double links are red links), S: 2 B: 12 / \\ \\ 1 5 13 / \ 4 6 // \\ 3 7 (a) (6) Consider the red-black tree above. Perform delete (4) operation for red-black tree S, showing each step. (b) (6) Perform Join (S; 10; B) on the ORIGINAL red-black trees in the above figure, showing each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 9 Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 9 Question 3 (12): (a) (6) Suppose that n keys are inserted into an empty B-tree of order m. What is the maximum height h in terms of n and m in the final B-tree? Show how you derive your answer. (b) (6) Given the following 5-way B+-tree, insert 40 and 100 in this order. Show each step and the resulting tree.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 9 Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 8 of 9 Question 4 (14): (a) (7) Insert the following keys into an initially empty instance of a splay tree, assuming that this is a bottom-up splay tree: 4, 1, 5, 9, 3, 8, 2 (b) (7) Consider the following top-down splay tree: Perform a split operation with respect to the node with the key 5, showing each step
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 9 of 9 Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 8 COP 5536 Advanced Data Structures Spring 2018 Exam 2 Solutions
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 8 Question.1 (12): Start with an empty AVL tree and perform insert operations using the following sequence of keys: 21, 23, 27, 26, 24, 25, and 22. Show each step. rotations : RR (3 points) -> LL (3 points) -> RL (3 points) -> LR (3 points) 24 / \ 22 26 / \ / \ 21 23 25 27
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 8 Question 2 (12): For the following red-black trees (double links are red links), S: 2 B: 12 / \\ \\ 1 5 13 / \ 4 6 // \\ 3 7 (a) (6) Consider the red-black tree above. Perform delete (4) operation for red-black tree S, showing each step. (b) (6) Perform Join (S; 10; B) on the ORIGINAL red-black trees in the above figure, showing each step. (a) After Delete 4 (6 points Marks are given for partially correct answer) 2 / \\ 1 5 / \ 3 6 \\ 7 (b) Numbers in parentheses represent ranks. i: Follow the right child pointer until rank(B) = rank(x), where rank(B) =1, x is a node pointer of tree S. ii: Combine subtree x, 10, and B (1 Point) 10 / \ 6 12 \\ \\ 7 13
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 8 iii: Combine the result of ii to node 5 through a red pointer (3 Points) 2 / \\ 1 5 / \\ 4 10 // / \ 3 6 12 \\ \\ 7 13 iv: Perform a RR rotation (2 Points) 5 // \\ 2 10 / \ / \ 1 4 6 12 // \\ \\ 3 7 13
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 8 Question 3 (12): (a) (6) Suppose that n keys are inserted into an empty B-tree of order m. What is the maximum height h in terms of n and m in the final B-tree? Show how you derive your answer. (b) (6) Given the following 5-way B+-tree, insert 40 and 100 in this order. Show each step and the resulting tree. (a) formulated problem correctly based on correct B-tree defition : 3 Correct final answer and derivation: 3 (b) for each correct insertion : 3 points for each minor mistake -1 if used incorrect insert algorithm : no point
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 8 Insert 100
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 8 Question 4 (14): (a) (7) Insert the following keys into an initially empty instance of a splay tree, assuming that this is a bottom-up splay tree: 4, 1, 5, 9, 3, 8, 2 (b) (7) Consider the following top-down splay tree: Perform a split operation with respect to the node with the key 5, showing each step (a) did not splay for each insert : 1 or no points perform correct splay operations for each insert and arrive at correct solution : 7 each splay error : -2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 8 of 8 (b) if knows the tree has to be divided in two parts : 2 performed splay at a correct point in a correct way : 3 splay operations has no mistake : 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 3 COP 5536 Advanced Data Structures Spring 2021 Exam 2 CLOSED BOOK 9:00 am 10:30 am (60 Minutes + Extra 30 Minutes for scanning & submission) PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on your own white blank paper. You may use extra scratch paper for calculation, but these will not be submitted. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Note. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses. Last Name: _____________ First Name: _______________ UFID: _______________ Q. 1 (10) Q. 2 (12) Q. 3 (14) Q. 4 (14) Total (50)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 3 Question 1 (10): For the following min Fibonacci heap, assume that the ChildCut field of all nodes is TRUE. (a) (4) Perform DecreaseKey operation by changing 11 to 2. Show the result. (b) (6) Perform DeleteMin operation on the resulting Fibonacci heap from (a), clearly label the ChildCut value. Show the result. Question 2 (12): Start with an empty two-pass MIN pairing heap, (a). (6) Insert the following sequence of keys: 35, 48, 24, 52, 13, 54, 60, 55, 19. Show the pairing heap after each insert. (b). (6) Perform a RemoveMin operation on the resultant min heap from (a). Show steps.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 3 Question 3 (14): Start with an empty AVL tree and perform insert operations using the following sequence of keys: 19, 23, 28, 26, 24, 25, and 20. Show each step and degree at each step. Question 4 (14): For the following red-black trees (double links are red links), (a). (7) Consider the red-black tree above. Perform delete (14) operation for red-black tree S, showing each step. (b). (7) Perform Join (S; 20; B) on the ORIGINAL red-black trees in the above figure, showing each step
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 1 of 8 COP 5536 Advanced Data Structures Spring 2021 Exam 2 CLOSED BOOK 9:00 am 10:30 am (60 Minutes + Extra 30 Minutes for scanning & submission) PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your answers directly on your own white blank paper. You may use extra scratch paper for calculation, but these will not be submitted. 3. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 4. You may use only a pen or a pencil. No calculators allowed. Note. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. The points assigned to each question are provided in parentheses. Last Name: _____________ First Name: _______________ UFID: _______________ Q. 1 (10) Q. 2 (12) Q. 3 (14) Q. 4 (14) Total (50)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 2 of 8 Question 1 (10): For the following min Fibonacci heap, assume that the ChildCut field of all nodes is TRUE. (a) (4) Perform DecreaseKey operation by changing 11 to 2. Show the result. (b) (6) Perform DeleteMin operation on the resulting Fibonacci heap from (a), clearly label the ChildCut value. Show the result. Solution : (a) Correct results(2pts), draw ChildCut and links (2pts) (b) Correct results(4pts), ChildCut value(2pts)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 3 of 8 Question 2 (12): Start with an empty two-pass MIN pairing heap, (a). (6) Insert the following sequence of keys: 35, 48, 24, 52, 13, 54, 60, 55, 19. Show the pairing heap after each insert. (b). (6) Perform a RemoveMin operation on the resultant min heap from (a). Show steps.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 4 of 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 5 of 8 Question 3 (14): Start with an empty AVL tree and perform insert operations using the following sequence of keys: 19, 23, 28, 26, 24, 25, and 20. Show each step and degree at each step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 6 of 8 Question 4 (14): For the following red-black trees (double links are red links),
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 7 of 8 (a). (7) Consider the red-black tree above. Perform delete (14) operation for red-black tree S, showing each step. (b). (7) Perform Join (S; 20; B) on the ORIGINAL red-black trees in the above figure, showing each step
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Page 8 of 8
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Instructor: Dr. Sartaj Sahni Summer 2012 Advanced Data Structures (COP 5536) Exam 3 CLOSED BOOK 60 Minutes Name: UFID: PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. For all problems, use only the algorithms discussed in class/text. 2. Write your name at the top of every exam sheet. 3. Write your answers directly on the exam question sheet. You may use scrap paper (supplied by your proctor) for work, but these will not be graded. 4. All answers will be graded on correctness, efficiency, clarity, elegance and other normal criteria that determine quality. 5. The points assigned to each question are provided in parentheses. 6. You may use only a pen or a pencil. No calculators allowed. 7. Do not write on the reverse side of the exam sheet. 8. Do not write close to the margins since those areas do not always make it through when faxed.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 1. (10 points) Consider the following splay tree: p / m / k / c \ j / d \ f \ g \ h (a) (5) Perform a search for element h under the assumption this is a Top-down splay tree. Show the tree(s) after each step of the splay. (b) (5) Do question (a) assuming a Bottom-up splay tree.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 2. (10 points) You are given a Bloom filter that consists of m = 13 memory bits and two hash functions f 1 () and f 2 () defined as below: f 1 ( k ) = k mod m f 2 ( k ) = (2 × k ) mod m ,where k is a given key. Assume that all m bits of the Bloom filter are initially set to 0. (a) (4) Show the Bloom filter bits following the insertion of the key 17. (b) (4) Into the Bloom filter of (a) (i.e. following the insertion of he key 17) insert 19. Show the resulting Bloom filter bits. (c) (2) For the filter of (b), give a key value that results in a filter error (i.e. the Bloom filter response is Maybe even though the key is not in the filter).
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 3. (10 points) You are given two strings S and T of length m and n , respectively. Describe how to find the Longest Common Substring of S and T using any data structure discussed in the class and provide an example. Your algorithm should run in linear time with respect to m and n .
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 4. (10) For the min radixprioritysearchtree (RPST) with range [0,63), (a) (8) Perform insert operations into an initially empty RPST in sequence with the following keys: (9,50), (33,10), (20,1), (60,12), (22,61), (10,37). Show each step. (Note: The elements x and y of a key ( x , y ) represents the search and priority key values, respectively.) (b) (2) Delete key (10,37) from the result RPST of Part (a).
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: 5. (10) Describe the 2-dimensional range tree data structure. Derive the formula for the preprocessing time P, the space required S, and the query time Q.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Name: Continue work here if necessary.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
file:///D|/COP5536%20Summer2012/My%20Work/Exam%203/solution.txt[7/22/2012 3:34:56 PM] 1. (a) p / m S B S B / k k m c j m / / \ / / \ c c p d k p \ \ \ j ===> j ===> f / / \ d d g \ \ \ f f h \ \ g g \ \ h h S B S B c f m c h m ===> \ \ / \ ===> \ / \ d g k p d k p \ / \ / h j g j / f h / \ c m \ / \ ===> d k p \ / g j / f (b) p p p p / / / / m m m m / / / / k k k h / / / / \ c c c c k \ \ \ \ / j ==> j ===> h ===> d j
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
file:///D|/COP5536%20Summer2012/My%20Work/Exam%203/solution.txt[7/22/2012 3:34:56 PM] / / / \ \ d d d j g \ \ \ / f h g f \ / / g g f \ / h f h / \ c m ===> \ / \ d k p \ / g j / f 2. (a) f1(17) = 17 mod 13 = 4 f2(17) = 2*17 mod 13 = 8 -------------------------------------- 0 0 0 0 1 0 0 0 1 0 0 0 0 -------------------------------------- bit 0 1 2 3 4 5 6 7 8 9 10 11 12 (b) f1(19) = 19 mod 13 = 6 f2(19) = 2*19 mod 13 = 12 -------------------------------------- 0 0 0 0 1 0 1 0 1 0 0 0 1 -------------------------------------- bit 0 1 2 3 4 5 6 7 8 9 10 11 12 (c) examples (1) k=4 f1(4) = 4 mod 13 = 4 f2(4) = 2*4 mod 13 = 8 Thus, the Bloom filter will respond "Maybe" but key "4" is not in the filter. (2) k=6 f1(6) = 6 mod 13 = 6 f2(6) = 2*6 mod 13 = 12 Thus, the Bloom filter will respond "Maybe" but key "6" is not in the filter.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
file:///D|/COP5536%20Summer2012/My%20Work/Exam%203/solution.txt[7/22/2012 3:34:56 PM] 3. Patricia a:0:00010 ==> a:0:00010 ==> a:0:00010 / / / a b:4:00000 b:4:00000 / \ / \ b a c:5:00001 a / \ b c ==> a:0:00010 ==> a:0:00010 ==> a:0:00010 / / / d:3:00100 e:1:11111 e:1:11111 / \ / \ / \ b:4:00000 d d:3:00100 e d:3:00100 f:2:10000 / \ / \ / \ / \ c:5:00001 a b:4:00000 d b:4:00000 d f e / \ / \ / \ b c c:5:00001 a c:5:00001 a / \ / \ b c b c o Node : (NodeLabel:BitNumber:Data) - NodeLabel is used to show the link of pointer to node. 4. A radix priority search tree can be defined as a set of ordered pairs [x,y] over 0..63 of integers maintaining a min-tree on y and a binary search tree on x. (a) Draw a radix priority search tree which contains pairs of [9,50], [33,10], [20,1], [60,12], [22,61] and [10,37]. (solution) [0,63](20,1) / \ [0,32](10,37) [32,63](33,10) / \ \ [0,16] [16,32] [48,63] (9,50) (22,61) (60,12) (b) (solution) [0,63](20,1) / \ [0,32](9,50) [32,63](33,10) \ \ [16,32] [48,63] (22,61) (60,12)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
file:///D|/COP5536%20Summer2012/My%20Work/Exam%203/solution.txt[7/22/2012 3:34:56 PM] 5. 2D range tree Assume we have N records with 2 keys, x and y. A 2-D range tree is a binary tree using the range of x, while in each node we keep a sorted list based on y. The tree always splits the records in half, using a median x key value as the discriminator. Preprocessing time P: we need to build a sorted list on y, and another on x. Since we have the sorted list on x, we can find the discriminator easily. And since we have the sorted list on y, we can split the list in linear time on each level ( there are logN levels overall ). So the preprocessing time is: P = NlogN + NlogN + N*logN = O(NlogN) Space required S: In each node we store an array of the records. At each level the number of records is N. So the space required is: S = N*logN = O(NlogN) Query time Q: Upon each query, we start at the root, decide which branch to take by comparing the boundaries of x with the discriminator. Once we arrive a node, we use binary search on y in the array. Then we report those records that fit the query. So the query time is: Q = logN*logN + F = O((logN)^2 + F) where F is the number of records reported.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help