Write a class of bst of employee records

Assignment Help Data Structure & Algorithms
Reference no: EM131232513

1. Refer to program p3-1-BinarySearchTree.cs

a. Write code to build a Binary Search Tree with the following nodes: 55, 29, 80, 22, 41, 72, 35, 78,44, 90, 18, 88, 25, 60. Print screen shot of the run.

b. Add one operation in your program that finds the height of BST. Find the height of the BST you build in a) by calling this method in the Main method

c. Draw the tree (on paper, preferably using MS-Word).

d. Draw the tree after deleting node 90

e. Draw the tree after deleting node 80 (from the original tree, not from after d))

f. Draw the tree after deleting node 55 (from the original tree, not from after d) and e))

g. Draw the tree after inserting a node whose key is 43 to the original BST.

2. In a BST with n nodes, how many comparisons are needed for searching, insertion, and deletion in worst case, respectively? How many comparisons are needed for these operation in average case, respectively?

3. Write a class of BST of Employee records (Employee empIDis used as key). The class must contain the following operations:

• Search a node (given anemployee's empID), and print the record when it is found.
• Insert a node (given a new employee record)
• Delete a node (given anemployee's empID)
• Print out of all employee records in the BST in in-ordertraversal.

Write the Main method to test your program as follows:

• Create an empty BST.
• Insert 10 Employee records into the BST in the following order:
empID Name Salary
1055 name1 Random 40k-90k
1029 name2 Random 40k-90k
1080 name3 Random 40k-90k
1022 name4 Random 40k-90k
1041 name5 Random 40k-90k
1072 name6 Random 40k-90k
1035 name7 Random 40k-90k
1078 name8 Random 40k-90k
1044 name9 Random 40k-90k
1090 name10 Random 40k-90k

and print the BST in in-order to confirm 10 records are inserted correctly.

• Search an employee record (given anemployee's empID), and print the employee record if the empIDis found.
• Delete an employee record (given anemployee's empID), and print the BST in in-order to confirm that the record is deleted.

The Employee class is given as follow:

classEmployee
{
publicstring name;
publicintempID;
publicdouble salary;

publicvoid Input()
{
Console.Write("Name: ");
name = Console.ReadLine();
Console.Write("ID: ");
empID = int.Parse(Console.ReadLine());
Console.Write("Salary: ");
salary = double.Parse(Console.ReadLine());
}
publicOutput()
{
Console.WriteLine("[{0}|{1}|{2:C}]", name, empID, salary);
}
publicoverridestringToString()
{
returnstring.Format("({0}|{1}|{2:C})", name, empID, salary);

}

}

Attachment:- p3-1_binarysearchtree.rar

Reference no: EM131232513

Questions Cloud

Create mission and vision statements : Professional letter from you to the local Chamber of Commerce introducing your new healthcare organization to the community. This is your opportunity to make a good, first impression, so be sure to incorporate the elements you would want to promo..
What are the possible remedies for the harms of trade : Who are the workers most hurt by trade in US? - What are the gains from trade, especially with China?- What are the possible remedies for the harms of trade?
Estimate the time it takes to bring the water : estimate the time it takes to bring the water to 50?C. Make enough simplifying assumptions so that you can solve the problem mathematically, that is find a formula for T(t).
Civil damages under an intentional tort theory : When individuals sue a police officer for civil damages under an intentional tort theory, the burden of proof is much higher if they are seeking punitive damages then the burden of proof in a typical misdemeanor criminal case
Write a class of bst of employee records : Write a class of BST of Employee records (Employee empIDis used as key). The class must contain the following operations:  Search a node (given anemployee's empID), and print the record when it is found.
Identifying comparative advantage : In your answer be sure to be very specific as to how you identified the comparative advantage in each country and define how one goes about identifying comparative advantage.
Compute the eventual percent increase in the money supply : Assume that households and firms keep 10c in currency for every Dollarthey deposit in banks and that banks keep 25c as reserves out of everDollar they receive as deposit. Compute the eventual percent increase inthe money supply if the monetary bas..
What will be the decrease in the longest side of the block : what will be the decrease in the longest side of the block, assuming that the material remains within the elastic region? What will be the decrease in the volume of the block?
The two sides of the debate are the opponents : The two sides of the debate are the opponents, who are the religious who feel that it is only God that can decide when to end somebody’s life and the disability rights groups whose concerns are of the potential for abuse and coercion. The disability ..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Design an adt for a two color double stack

Design an adt for a two color double stack adt that consists of two stacks one red and one blue and has its operations color coded versions of the regular stack adt operations.

  Calculate the number of points a publication provides

In this exercise you shall work with a system of records for publications associated with research and development.

  Implementing a simple spell checking program

Implementing a simple spell checking program using binary search trees. One of the most-used applications of computers today is checking spelling. In this question, you will load a large dictionary (approximately 173,529 words) into a binary searc..

  Write a program that implements dijkstras algorithm

Write a program that implements Dijkstra's algorithm

  Explain sorting algorithm which is optimal in cost

Explain a sorting algorithm which is optimal with respect to this cost model and uses O(n) space. That is, time used by algorithm should exactly match lower bound

  Find fraction of time during which queue grows

Suppose now there are three users. Find the probability that at a given time, all three users are transmitting simultaneously. Find the fraction of time during which the queue grows.

  Transmitting image using raster scan order

If we were to transmit this image using raster scan order, after 15 seconds how many rows of the image will the user have received?

  Draw the recursive process of quicksort

Draw the recursive process of Quicksort and Mergesort for sorting the sequence {5, 1, 2, 9, 7}. You will get a recursion tree for Quicksort and Mergesort respectively. What are their depths?

  Design a linked list structure

Design a linked list structure Music that contains data fields Name, Artist, Number_of_Songs, and a pointer to the list. Design the structure with three members and fill in data for each member.

  The decision tree inductive learning algorithm

The Decision Tree inductive learning algorithm may be used to generate "IF ... THEN" rules that are consistent with a set of given examples. Consider an example where 10 binary input variables X1, X2, , X10 are used to classify a binary output variab..

  Analyze case asymptotic complexity of making interference

Analyze the worst-case asymptotic complexity of making an interference graph, for a program of size N (with at most N variables and at most N control-flow nodes).

  Best and worst use of message digest algorithms

Best and Worst Use of Message Digest Algorithms- You are required to submit a single comprehensive written document conforming to the following requirements

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