Homework Balanced Trees (1)

.docx

School

Collin County Community College District *

*We aren’t endorsed by this school

Course

3345

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

7

Uploaded by aisha13qurffff

Report
2-3-4 Trees (Preemptive Split) 1. Draw the 2-3-4 (M=4) tree that results from inserting the keys: 1, 12, 8, 2, 25, 6, 14, 28, 17, 7, 52, 16, 48, 68, 3, 26, 29, 53, 55, 45. Show your work. 2. Remove in this order: 3, 17, 55, 1, 52, 48, 2, 14, 25 Show your work. 3. Splay Tree a. What is a splay operation? b. Why to prefer splay trees? c. Which of the following options is an application of splay trees?
i. cache Implementation ii. networks iii. send values iv. receive values d. When we have red-black trees and AVL trees that can perform most of operations in logarithmic times, then what is the need for splay trees? e. What is the disadvantage of using splay trees? 4. Given the BST below, show the BST that would result after inserting the key of value 10 if splaying is performed starting at the node that was inserted. 5. Given the BST below, show the BST that would result after inserting the key of value 180 if splaying is performed starting at the node that was inserted.
6. A nice property of splay trees is that each of Find, Insert and Delete takes O(logn) time. True/False? False 7. The keys of value N, N-1, N-2..., 4, 3, 2, 1 are inserted in this order in a splay tree. What is the final configuration of the tree? What is the cost in Big-Oh notation of each insert operation? 8. Assume now that the next 100 operations will be a mix of only Find(1), Find(2) and Find(3), i.e., search in the tree for either the key of value 1, or the key of value 2, or the key of value 3. After each successful search, splaying is performed from the node where the key was found. What are the 3 tree configurations that are possible after these 100 operations are completed? What is the cost in Big-Oh notation of each Find operation? 9. Red-Black Tree Show the result of inserting 50 into the Red-Black tree depicted below: 30 / \ 15 45 / \ 35 60
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help