Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Discrete Mathematics! Answer all of the questions. Problem 3. A height balanced binary tree is a binary tree whose subtrees differ in height by

In Discrete Mathematics! Answer all of the questions. image text in transcribed
image text in transcribed
Problem 3. A height balanced binary tree is a binary tree whose subtrees differ in height by at most one. This means that height balanced trees are as close to full binary trees as possible even when the number of vertices precludes it. In order to bring the height of a tree into balance we must consider two particular operations, left rotations, and right rotations. These are described pictorially below: Rotate Left tx tyL tvR tx tvL Here, the vertex y becomes the parent of vertex , the left child of y becomes the right child of r, and the parent of r becomes the parent of y. Similarly consider the right rotation shown below Rotate Right ty txL ty The rectangles tr, ty,tyL,tyR,tzL, trR are subtrees from the parent vertices. These subtrees may be empty, the rotations still work the same way. (a) Suppose a binary tree has 100 vertices, what is the maximum height of such a tree if it is to be height balanced? (b) Now consider the most unbalanced binary tree possible which has 100 ver- tices. That is a single line starting with vertex where is the parent of 0+1 How many rotations are necessary to height balance this tree

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions