hw1 - assuming the node containing 60 is deleted from the...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3530 – Homework Problems #1 – Summer 2002 Due Monday June 10 th at class time. 1. Shown below is a BST which is unbalanced. Use the DSW algorithm to create a perfectly balanced version of this tree. Show all intermediate steps in both the creation of the backbone as well as the rotations that will occur to convert the backbone into the perfectly balanced tree. 2. For the AVL tree shown below, perform the necessary rotations to balance the tree assuming a new node containing 35 is inserted into the tree. For each rotation that is required identify the type of rotation, i.e., right, left, or double. Show the balance factors at every node before and after the rotation. Draw the resulting AVL tree. 45 40 55 25 15 35 85 30 38 70 65 60 3 2 6 2 4 8 3 5
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
3. For the AVL tree shown below, perform the necessary rotations to balance the tree
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: assuming the node containing 60 is deleted from the tree. For each rotation that is required identify the type of rotation, i.e., right, left, or double. Show the balance factors at every node before and after the rotation. 4. For the red-black tree shown below, determine the type of imbalance that will occur if a new node containing 70 is inserted into the tree. Perform and describe the action that must be performed to rebalance the tree in this case. 40 20 50 30 60 80 4 3 6 3 5 1 2 3 9 9 9 9 9 5. For the red-black tree shown below, determine the type of imbalance that will occur if the node containing 70 is deleted from the tree. Perform and describe the action that must be performed to rebalance the tree in this case. 60 40 70 30 80 85 20 50 90...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern