Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment: Data Structures and Algorithms

In this project, you are going to reuse your BST from program 1 and create an implementation of a red-black tree using a subclass of BinaryNode. In addition to the normal functions of a red-black tree, as discussed in class, you will add the following methods:

a) Count the number of leaves in a tree with data.
b) Return the height of the tree.
c) Return a listing of all the nodes in our tree with values between a and b

(a and b being values given to us by the user)

Your program should:

- Randomly generate 100 values
- Load the values which were generated into both an instance of your BST and red-black tree programs
- Offer the user a menu with the following options:

o Insert a new value (ignore repetitions, values should be added to both trees)
o Delete a value (values should be deleted from both trees)
o Return a count of the leaves of both trees
o Return a listing of all values in the tree between a and b, where a and b are input by the user.
o An option for the user to delete the first 20 entries in the trees encountered by a preorder traversal if possible. Once completed, this option will automatically display the new height of the tree, and the count of the remaining leaves in both trees.

- Provide an option to exit the program

(Your program should continue displaying the menu after each action is completed until the user chooses to quit)

In your project report, you need to analyze the differences in our BST and red-black trees. Which seems to be more efficient? Why is that?

You are free to choose how you present the menu to the user.

Computer Engineering, Engineering

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

Have any Question?


Related Questions in Computer Engineering

Sometimes when we visit super markets we may share our

Sometimes when we visit super markets, we may share our personal details to get (for example) "Loyalty cards" and other benefits. Do you think sharing such details is a good approach? Give arguments for both cases: "shar ...

Question the chief technology officer cto has indicated

Question: The Chief Technology Officer (CTO) has indicated that your organization has been requested by the National Security Council (NSC) to comment on the upcoming National Cybersecurity Strategy. The NSC has asked fo ...

Questionbased on the option chain below consider an

Question: Based on the option chain below : Consider an asymmetric butterfly constructed using the given put options with the low strike at 58, the peak at 60 and the high strike at 64, for one unit of the underlying ass ...

Why are we in the golden age of technology entrepreneurship

Why are we in the 'golden age' of technology entrepreneurship? What factors are helping entrepreneurs more rapidly achieve their vision, and with a lower cost?

Please discuss the design principles that guide the authors

Please discuss the design principles that guide the authors of instruction sets in making the right balance. Provide examples of application of each of the three design principles while designing instruction sets.

Can you help me how i can connect 2 new sub java classes to

Can you help me how I can connect 2 new sub java classes to the main one with CSV file? I will attach the instruction and the CSV file if you guys accept this. Please help me do it. Please add descriptive comments so I c ...

The business model for jpmorgan chase was change in 2008

The business model for JPMorgan Chase was change in 2008. Could the upside of the strategy have been achieved without exposing JPMorgan Chase the bank?

What are impacts that flexible work schedules can have on a

What are impacts that flexible work schedules can have on a employee's productivity?

Information systemsdirections answer the following if you

Information Systems Directions : Answer the following: If you were asked to develop a logical model of the registration system at a school, would it be better to use a top-down or bottom-up approach? Explain your reasoni ...

We say that a binary tree t is perfectly balanced if for

We say that a binary tree T is perfectly balanced if, for each node n in T , the number of keys in the left and right subtrees of n differ at most by 1. Write an algorithm called Is-Perfectly-Balanced that, given a binar ...

  • 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