Purchase Solution

Divide and Conquer a Binary Tree

Not what you're looking for?

Ask Custom Question

Consider an n-node complete binary tree T, where n=2^d - 1 for some d. Each node v of T is labeled with a real number x_v. You may assume that the real numbers labeling the nodes are all distinct. A node v of T is a local minimum if the label x_v is less than the label x_w for all nodes w that are joined to v by an edge.

You are given such a complete binary tree T, but the labeling is only specified in the following implicit way: for each node v, you can determine the value x_v by probing the node v. Show how to find a local minimum of T using only O(log n) probes to the nodes of T.

Purchase this Solution

Solution Summary

This solution provides guidelines to show how to find a local minimum of a binary T.

Solution Preview

For each node v, it has label x_v. It has a left child u and a right child w. We have the following three cases:
Case 1: x_u < x_v < x_w. Then I go to subtree rooted at u and continue to check whether u is a local minimum or not.
Case 2: x_w < x_v < x_u. Then I go to subtree rooted at w and continue to check whether w is a local minimum or not.
Case 3: x_v < x_u and x_v < x_w. Then I claim that v is a local minimum. Because v has three neighborhood nodes u, w and its parent, say p. the label of v is less than the label of u and w. From case 1 an case 2, v is obtained because its label
x_v is less than the label x_p of its parent ...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.