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

  Methods of generated data experiments

Overview of the different methods of generated data experiments - Some of visualization techniques are provided in this research to show how well the predictive modelling is performing and show an interesting method in the data related to the proje..

  Opens an output file with the external name

Design an algorithm that does the following: opens an output file with the external name number_list.dat, uses a loop to write the numbers 1 through 100 to the file and then closes the file.

  Cloud computing assignment

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

  Define wan and provide an example of typical wan setup

Define a WAN and provide an example of a typical WAN setup and describe the components. Provide a picture, chart, or image if possible.

  Determine the branching factor

Expalin the search algorithm that results from each of the following special cases. How does it relate to other algorithms we have discussed.

  Question about edge connectivity

The edge connectivity of an indirected graph is minimum number k of edges that must be removed to disconnect the graph.

  Calculate bits number output of first round-des decryption

Calculate the bits number 1, 16, 33, and 48 at output of first round of DES decryption, suppose that ciphertext block is composed of all ones

  How to use depth-first search to find out in time

Illustrate how to use depth-first search to find out in time O(|E|+|V |) whether undirected graph is 2-colorable. Describe and explain your strategy.

  Use a search tree to find the solution

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

  Find the strongly connected components of a directed graph

Describe an algorithm based on depth-first search to find the strongly connected components of a directed graph.

  Create algorithm to read arbitrary number of data record

Create the algorithm to read arbitrary number of data records, each containing name, age, and code. Code of 1 will indicate female, a code of 2 will indicate male.

  What is difference between serial and sequential searching

What is the difference between serial, sequential and indexed sequential searching

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