Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question: A binary tree can be generated automatically for desktop publishing by a program. You can write this program by assigning an x-y coordinate to each tree node, drawing a circle around each coordinate, and connecting each nonroot node to its parent. Assume that you have a binary tree stored in memory and that each node has two extra data members for storing the coordinates. Assume that (0, 0) is the top-left corner. Do the following.

a. The x-coordinate can be computed by assigning the inorder traversal number. Write a routine to do so for each node in the tree.

b. The y-coordinate can be computed by using the negative of the depth of the node. Write a routine to do so for each node in the tree.

c. In terms of some imaginary unit, what will be the dimensions of the picture? Also determine how you can adjust the units so that the tree is always roughly two-thirds as high as it is wide.

d. Prove that when this system is used, no lines cross and that for any node X, all elements in X's left subtree appear to the left of X, and all elements in X's right subtree appear to the right of X.

e. Determine whether both coordinates can be computed in one recursive method.

f. Write a general-purpose tree-drawing program to convert a tree into the following graph-assembler instructions (circles are numbered in the order in which they are drawn):

circle( x, y );  // Draw circle with center (x, y)

drawLine( i, j );  // Connect circle i to circle j

g. Write a program that reads graph-assembler instructions and outputs the tree to your favorite device.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92475769
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

The appendix to chapter one will be very useful in

The appendix to chapter one will be very useful in answering this question, if you need a refresher or introduction to regression analysis. The following equation is the regression results of a study on infant mortality ...

Question suppose you have to design a mobile application to

Question : Suppose you have to design a mobile application to control your microwave over internet. Define the objective, assumptions and Interface Metaphors of this application.

At a certain temp the kp for the decomposition of h2s is

At a certain temp, the Kp for the decomposition of H2S is .883. H2S (g) ----> H2(g) + S (g) Initially, only H2S is present at a pressure of  .181 atm  in a closed container. What is the total pressure in the container at ...

Question group work this weekbull introduce yourself to

Question: Group work this week: • Introduce yourself to your group • Start planning out the project with your group • The group should compile the following information into a draft document 1. What specific and detailed ...

Espn pays the nfl 11 billion per year for 8 yrs for the

ESPN pays the NFL $1.1 Billion per year for 8 yrs for the right to exclusively televise football. What is the NPV of the investment if the parent Disney CO has an opportunity interest rate that is equal to the cost of ca ...

Question suppose an instruction can be carried out in 3

Question : Suppose an instruction can be carried out in 3 stages, the stages taking 3 ns, 7 ns, and 10 ns, respectively. (a) What is the maximum execution rate without pipelining? (b) What speedup is possible with pipeli ...

In statistics the mode of a set of values is the value that

In statistics, the mode of a set of values is the value that occurs most often or with the greatest frequency. Write a function that accepts as arguments the following: A. An array of integers B. An integer that indicate ...

Question i you are part of a disaster recovery team charged

Question: I. You are part of a disaster recovery team charged with completing the asset inventory at a small business that primarily sells a small selection of products to the public. 2. Establish a sample hardware asset ...

Albert hoffmans wife has an ipod shuffle with five songs in

Albert Hoffman's wife has an iPod shuffle with five songs in her library: November Rain  by Guns 'N Roses Ain't No Mountain High Enough  by Nicholas Ashford and Valerie Simpson Call Me Maybe  by Carly Rae Jepsen Rainbow ...

All rsa cryptosystem has public key n 35 and e 7 messages

All RSA cryptosystem has public key N = 35 and e = 7. Messages are encrypted one letter at a time, converting letters to numbers by A = 2, B = 3, .... Z = 27, space = 28. Showing your working, encrypt the message: BE GOO ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As