Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Only question 4 Create a C# console application that fulfills the following requirements: 1. Get a list of integer numbers from the user on A

Only question 4

Create a C# console application that fulfills the following requirements:

1. Get a list of integer numbers from the user on A SINGLE LINE

The numbers will be in the range [0,100]

The numbers will be separated by spaces

You may assume that the user enters a correctly formatted input string that meets these requirements

You may use Console.ReadLine or a similar method to get input from the user

2. Add all the numbers to a binary search tree in the order they were entered

Dont allow duplicates

Use the Split function on the entered string for easy parsing (split on the space character)

3. Display the numbers in sorted order (smallest first, largest last).

Traverse the tree in order to produce this output.

4. Display the following statistics about the tree

Number of items (note that this will be less than or equal to the number of items entered by the user, since duplicates wont be added to the tree). Write a function that determines this from your BST, NOT the array returned from the split. In other words, you must have a Count function in your BST implementation.

Number of levels in the tree. A tree with no nodes at all has 0 levels. A tree with a single node has 1 level. A tree with 2 nodes has 2 levels. A tree with three nodes could have 2 or 3 levels. You should know why this is from your advanced data structures prerequisite course.

Theoretical minimum number of levels that the tree could have given the number of nodes it contains (figure out the formula to calculate this)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data In Just 7 Chapters

Authors: Prof Marcus Vinicius Pinto

1st Edition

B09NZ7ZX72, 979-8787954036

More Books

Students also viewed these Databases questions