Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Use a random number generator to create 10 numbers between 1 and 1000 and store them in 2 different arrays.  The first array should contain the numbers as they are generated.  The second should store the same numbers in a tree implemented as acomputed link array using the strategy described below:

  • the first element generated will be the root
  • the rest of the elements will be stored in the left subtree if it is smaller than the root (or parent), otherwise it is stored in the right subtree
    1. when entering the left subtree, the same strategy must be used to find the proper place in the left subtree (if new element is less than the parent, go into left subtree, otherwise go into right subtree)
    2. continue this pattern until an empty spot is found in the array, and store the element there

I suggest you make your computed link array capable of holding at least 20 items, since there will be wasted space. Once you've created the binary tree, then implement the inorder visit code from the lecture slides and conduct an inorder visit on the tree you created printing out each parent as you visit it.  If you've set up the tree correctly, the output numbers should be sorted.

For this problem, output the original data, the data as stored in the computed link array (and draw lines on your output to show the children of each parent), and the output obtained from the inorder visit.

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9530613

Have any Question?


Related Questions in Computer Engineering

In linux what synchronization methods they use within the

In Linux what synchronization methods they use within the kernel, please dig into your findings for Linux.

Question will services follow the trend of manufacturing in

Question : Will services follow the trend of manufacturing in being outsourced and offshored from industrial countries to developing countries? Are all services at risk of being offshored? The response must be typed, sin ...

By chance does any know what percentage of the world gdp

By chance does any know What percentage of the world GDP has the Global 500 contributed most recently?

Use state-transition testing to solve the following testing

Use state-transition testing to solve the following testing problem. In a course registration system, students can register for a given course when the course is in the open state. At the end of the registration period, ...

Reading the biographybook where the body meets memory by

Reading the Biography Book : "Where the Body Meets Memory" by David Mura Questions: The internment camps were a very painful experience for Japanese Americans. They were also a very important and awkward chapter in Ameri ...

A video movie store owner finds that 30 of the customers

A video movie store owner finds that 30% of the customers entering the store ask an assistant for help and that 20% of the customers make a purchase before leaving. It is also found that 15% of all customers both ask for ...

Roberto is the network administrator for an international

Roberto is the network administrator for an international law firm with offices and customers in North America, South America, Africa, and the Middle East. The lawyers frequently contact each other via e-mail, use the In ...

Item 4 is the tester program for implementing the amusement

Item 4 is the tester program for implementing the Amusement Park. I am looking for an Amusement Park Tester program that is in Java. None of the answers included the tester program! I need to: Design a tester class calle ...

Answer the following questions whats the synchronous

Answer the following Questions : What's the synchronous distribution ? What are the guidelines for menu layout or list them?

Question 1 explain the various types of green architecture

Question: 1. Explain the various types of Green architecture within the enterprise, such as information architecture and solutions architecture. 2. Explain how a Green systems architecture evolves from a basic to a linea ...

  • 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