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

  Describe properties of bfs and dfs for acyclic tree

Analyze the given properties of BFS and DFS for Acyclic Tree without making any assumptions. Optimality, Completeness.

  Why are heaps useful in sorting

Define a heap and explain how trees can be turned into heaps.

  Describe main tenets of theory and how they affect behavior

Describe the main tenets of the theory and how they affect behavior.

  Describe a possible change in one of the domains of analysis

Analyze the two working models for understanding different health care systems and determine which model would be most useful to you in your current (or future) position in the health care industry. Provide specific examples to support your respon..

  Declare a double array

Question 1: Declare a double array of size 100. Question 2: Fill out the array with 1 if a random value is greater than 0.5 else 0 Question 3: print the number of 0's in the array .

  Does a deterministic algorithm exist for the given case

Does a deterministic algorithm exist for this case? Give a randomized algorithm that is partially correct, process-term­ inates with probability one.

  Er modeling

A supplier supplies certain number parts for a assignment, a assignment uses the parts from the different suppliers, and the same kind parts from different suppliers are used by different assignments.

  Describing the data types

Create a 10-12 slide presentation describing the data types. Include the following in your presentation: Introductory slide and Slide for each data type

  Identify data structures to organize typical file cabinet

Identify at least two data structures that are used to organize a typical file cabinet. Why do you feel it is necessary to emulate these types of data structures in a computer program?

  Modify the array-based linear search algorithm

Modify the array-based linear search algorithm to make it more efficient for ordered lists.

  Can you find the element of an array

We would like to determine whether a given array A has a majority element, and if so, find the element.

  Creating an interactive java program

Create an interactive Java program that illustrates the use of constructors, methods, loops and arrays.

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