Write a program that reads graph-assembler instructions

Assignment Help Data Structure & Algorithms
Reference no: EM131667067

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.

Reference no: EM131667067

Questions Cloud

Implement the recursive routines with tests : Implement some of the recursive routines with tests that ensure that a recursive call is not made on a null subtree.
Define parameters for including or excluding studies : The most important step in any research process is. define parameters for including or excluding studies as part of the comprehensive literature review.
What is the history of forensic science : What is the history of forensic science as it relate to how we solve cases today?
Bank in chicago deposits a check : A customer at a bank in Chicago deposits a check. The bank video camera captures an image of the customer entering the bank branch and matches
Write a program that reads graph-assembler instructions : 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.
Explain what a fingerprint is : Explain what a fingerprint is. Describe each of the three classes of fingerprints. Which class is the most common in the population and which is least common?
Make investigating arson and explosions : Explain three factors that make investigating arson and explosions particularly difficult for forensic scientists.
How are you going to deal with the employee : How are you going to deal with this Employee? Paper is expected to be free of grammatical, punctuation and sentence structure errors.
Understand an organization''s working environment : As a forensic investigator, you know how important it is to understand an organization's working environment.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd