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

  Various search trees and numerous sorting techniques

This week we were introduced to various search trees and numerous sorting techniques. Taking into consideration what you have learned this week, discuss how you can help Bob with his problem.

  Explain the fundamental concepts of cryptographic algorithms

Explain the fundamental concepts of cryptographic algorithms. Examine malicious activities that may affect the security of a computer program and justify the choice of various controls to mitigate threats.

  Write algorithm find intersection of two singly-linked list

Write an algorithm (pseudocode) to find the intersection of two singly-linked lists. Assume that the data in each list are in nondecreasing order.

  Basic heap operations

Heap This question is designed to help you get a better understanding of basic heap operations. You will be given queries of 3 types:• "1 v" -Add an element v to the heap.• "2 v" -Delete the element v from the heap.• "3" -Print the minimum of all the..

  Question 1a bubble sort in ascending order1 pseudo

question 1a bubble sort in ascending order.1. pseudo codefunction bubblesortimport array export arrayfor pass not 0 to

  A multinational tour operator agency has gained new

a multinational tour operator agency has gained new business growth in the north american market through the use of

  Find all pure-strategy nash equilibria

Consider the payoff matrix shown at right. Suppose agent 1 must move first, and agent 2 can see B agent 1's move before agent 2 chooses a move. Draw the game tree, find all pure-strategy Nash equilibria, C and tell which of them are subgame-perfec..

  Find the longest monotonically

Describe an O(n) time algorithm that, given a set S of n distinct numbers and a positive integer k ≤ n, determines the k numbers in S that are closest to the median of S.

  What is object modeling and what are the alternatives

What is OBJECT modeling. What is involved. What are the alternatives

  How to compute the depth of a tree with the update algorithm

Show how to compute the depth of a tree with the Update algorithm. Show that the Update algorithm can be used for election and computation of a breadth-first search spanning tree by giving an appropriate path-cost function.

  Running time analyses of all the methods

You need to give the running time analyses of all the methods in terms of the Big O notation. Include your running time analyses in the source file of the CompressedSuffixTrie class and comment out them.

  Calculate the diffie-hellman key values

Calculate the Diffie-Hellman key values. Calculate values for both keys (secret key a and secret key b). You must show your work for full credit.This includes the calculations each person performs to calculate and verify the values.

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