Perform in-order traversal to print all students in the tree

Assignment Help Data Structure & Algorithms
Reference no: EM132082627

needs to be written in just regular c++ , and needs to be able to fucntion with the M numbers that are provided in the instructions

Objective: To be familiar binary search tree and hash table.

Description: Implement a binary search tree using hash table.

In this project, you are required to implement a binary search tree using hash table. In C++, hash table is represented by the STL class template: unordered_map. Please check this page for member functions and examples of unordered_map.

In the binary search tree, each node contains a student object. The student object should contains M#, phone number, and address. M# is a string starting with char ‘M' and followed by digits, such as "M12345678". In the hash map, the key is student's M#, and the value associated with the key is the following structure:

struct TreeNode {

Student item;

string left_child_M#;

string right_child_M#;

};

If the M# of its left or right child doesn't exist, set its value to "M00000000".

Requirements:

Define and implement Student class. Make sure it contains M#, phone number, and address, all getters and setters, and constructors. In addition, override < operator to compare student objects by M#, and the << operator for output.

Define and implement BST class to represent binary search tree. In this class, you should have:

A member data of the type unordered_map< string, TreeNode> to hold nodes in the binary search tree.

Member functions for in-order traversal, searching by M#, inserting a new Student object, and deleting by M#.

In the main function, which should be included in ola6.cpp file, please perform the following operation in the given step:

Create an empty binary search tree;

Insert the following M#s to the BST in the given order: M00000005, M00000003, M00000002, M00000001, M00000004, M00000006, M00000009, M00000008, M00000007. M00000010. Feel free to come up with other information for each student object.

Perform in-order traversal to print all students in the tree;

Search the student with M# = ‘M00000007'. Print all information of the student.

Delete the student with M# = ‘M00000002';

Perform in-order traversal to print all students in the tree;

Delete the student with M# = ‘M00000005'.

Perform in-order traversal to print all students in the tree;

Reference no: EM132082627

Questions Cloud

Performance of our public schools : How would you go about measuring the performance of our public schools? Or what strategies would you use to improve them?
Which networking standard would you recommend : You are a network administrator responsible for all network platforms and services for a software development company.
How would you decide on a policy regarding whether people : How would you decide on a policy regarding whether people can use hand-held cell phones, hands-free cell phones
Funding of political science research : Do you agree or disagree with Senator Coburn's call for reducing federal funding of political science research?
Perform in-order traversal to print all students in the tree : Define and implement Student class. Make sure it contains M#, phone number, and address, all getters and setters, and constructors.
Design a uml class diagram for the leading class : Design a pseudocode algorithm for any method that will have two or more statements. Design a pseudocode algorithm for the test class .
What protocol similarly provides a network layer address : The neighbor discovery protocol (NDP) is used to look up a link layer address when one has only an address for some layer above the link layer.
What risks and rewards may emerge : What risks and rewards may emerge from an increase in the use of the powers of the office.
Dirtiest media campaigns in history : Which president's 1828 victory over John Quincy Adams is generally considered one of the dirtiest media campaigns in history?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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