Determine if two general trees are identical

Assignment Help Basic Computer Science
Reference no: EM131245389

1. Write an algorithm to determine if two general trees are identical. Make the algorithm as efficient as you can. Analyze your algorithm's running time.

2. Write an algorithm to determine if two binary trees are identical when the ordering of the subtrees for a node is ignored. For example, if a tree has root node with value R, left child with value A and right child with value B, this would be considered identical to another tree with root node value R, left child value B, and right child value A. Make the algorithm as efficient as you can. Analyze your algorithm's running time. How much harder would it be to make this algorthm work on a general tree?

Reference no: EM131245389

Questions Cloud

The basis of mean and variance which asset is preferred : If the only available choice is 100% of your wealth in X or 100% in Y and you choose on the basis of mean and variance, which asset is preferred?
Raise prices to monopoly levels when it had no competition : One of the concerns about Walmart's entry into the grocery business in the latter part of the 1990s was that it would set low prices, drive little stores out of business, and then raise prices to monopoly levels when it had no competition. That hasn'..
Substitution for consumer at the competitive equilibrium : Suppose there are two consumers, A and B, and two goods, X and Y. Consumer A is given an initial endowment of 6 units of good X and 1 units of good Y. Consumer B is given an initial endowment of 2 units of good X and 7 units of good Y. Suppose the pr..
Prepare a written retirement plan for john and mary : Please prepare a written retirement plan for John and Mary. As you will need to make certain assumptions in order to complete this project, please list those assumptions very clearly. You will need to cover the following items, at a minimum
Determine if two general trees are identical : Write an algorithm to determine if two general trees are identical. Make the algorithm as efficient as you can. Analyze your algorithm's running time.
What accounts for the difference in the two percentages : What accounts for the difference in two percentages? What was the percentage change in Nominal GDP for  most recent quarter compared to previous quarter? What was the percentage change in Real GDP for two quarters?
Describe the environmental history for the area : To help identify a region with known environmental events for this assignment, consult your textbook, the WHO Public Health and Environment Program's Web site, and the UNEP's Web site. Please be sure to support your public health analysis of these..
Is the initial allocation pareto efficient : Suppose there are two consumers, A and B. The utility functions of each consumer are given by: UA(X,Y) = X*Y UB(X,Y) = 2X + Y The initial endowments are: A: X = 4; Y = 2 B: X = 4; Y = 6. What is the marginal rate of substitution for consumer A at the..
Calculate the mean and variance of the earnings per share : Calculate the mean and variance of the earnings per share for each company. - Explain how some investors might choose A and others might choose B if preferences are based on mean and variance.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write a function prototype for a function

Write a complete function called calcTriArea that will calculate and return the area of a triangle. It takes two float/double values: the base and height as its arguments. The area of a triangle is one-half the base times the height.

  What is the average length of the search

To implement the various placement algorithms discussed for dynamic partitioning (Section 7.2), a list of the free blocks of memory must be kept. For each of the three methods discussed (best-fit, first-fit, next-fit), what is the average length o..

  Give an algorithm to achieve consensus for this consensus

Give an algorithm to achieve consensus for this consensus number.

  Create files as defined in the previous individual project

List the contents of the current directory. Create the directory structure and create the files as defined in the previous Individual Project.

  Differences between a compiler and an interpreter

High-level languages can be compiled or interpreted. Give two differences between a compiler and an interpreter.

  Encourage owner participation and promote travel programs

You are an employee of Calypso Travel Club, which is a timesharing resort management company. Your position requires that you encourage owner participation and promote travel programs.

  Short persuasive speech

First, you want to write a short persuasive speech, just two pages long, using any one of the following five speech types: (1) stimulate, (2) convince, (3) call to action, (4) increase consideration,

  Write code that merges two sorted arrays

Write a code that merges two sorted arrays so that the result is a sorted array. In your code, declare an array called ‘A1’ of size 5 and an array ‘A2’ of size 5. Fill them with numbers that are in ascending order.

  Create an new windows form application

Create an new windows form application. Add 2 controls that can display multi-line text. Use the application to enter data into an ArrayList (or you can initialize the arrayList via the application).

  How long will it take to reach steady-state value

Investigate the effect of the parameter b on y(t). To do this, plot y versus t for several values of b on the same plot. How long will it take for y(t) to reach 98 percent of its steady-state value?

  Find its minimum spanning tree

Modify the bfs.java program (Listing 13.2) to find the minimum spanning tree using a breadth-first search, rather than the depth-first search shown in mst.java (Listing 13.3). In main(), create a graph with 9 vertices and 12 edges, and find its mi..

  Can an 00 approach be used to develop any system

Can an 00 approach be used to develop any system? What are the strengths of object orientation? What are its weaknesses? Give an example of a system where object orientation would not be an appropriate development strategy.

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