Implement inorder preorder and postorder traversal functions

Assignment Help Data Structure & Algorithms
Reference no: EM131471643

Data Structures Assignment: InOrder, PreOrder, and PostOrder Traversal in a Binary Search Tree (BST)

In this assignment, you will implement inorder, preorder, and postorder traversal functions on a binary search tree.  

public:

void inOrder(void(*func)(const T &)) const;

void preOrder(void(*func)(const T &)) const;

void postOrder(void(*func)(const T &)) const;

private:

void inOrder(void(*func)(const T &), bst_node<T>* node) const;

void preOrder(void(*func)(const T &), bst_node<T>* node) const;

void postOrder(void(*func)(const T &), bst_node<T>* node) const;

Each of these traversal methods matches a public method that takes a function pointer as a parameter with an overloaded private method that takes a function pointer and a binary-search-tree node pointer as parameters. The private method is recursive.  The reason the matching of public and private functions is necessary is that the private function takes a node pointer in the second parameter position; node pointers are private to the binary search tree.

Please download the starter files for this assignment from the Files tab (Assignment8.zip). Do not alter the class definition or driver code in any way. Programs that crash are subject to a 50% penalty.   Please submit the class header file only ("bst.h").  PLEASE NOTE: You may not use any Standard Template Library (STL) classes for this assignment; use code provided by the instructor only. 

Here is an example: suppose you have the following BST:

2374_Figure.png

BST.inOrder(); yields 14->21->24->25->28->31->32->36->39->41->47

BST.preOrder(); yields 32->24->21->14->28->25->31->41->36->39->47

BST.postOrder(); yields 14->21->25->31->28->24->39->36->47->41->32

Attachment:- Assignment Files.rar

Reference no: EM131471643

Questions Cloud

How to prevent juveniles from committing serious crimes : Write an essay on "How to desist or prevent juveniles from committing serious crimes".
Physician or advanced practice provider : Research the typical patient and provider (physician or advanced practice provider) workflow for an ambulatory, in person, visit.
What market interest rate per quarter would be associated : What market interest rate per quarter would be associated with a quarterly inflation rate of 5% and a real interest rate of 2% per quarter?
International aviation policies : Negotiation and decision-making principles as they apply to aviation related businesses operating in an international environment
Implement inorder preorder and postorder traversal functions : CS 20A: C++ Data Structures Assignment. In this assignment, you will implement inorder, preorder, and postorder traversal functions on a binary search tree
Common law and separation of power : Differentiate between checks and balances in the separation of power. Specify two (2) examples related to health care from your state government.
What is necessary to make a valid gift : How does tangible personal property differ from intangible personal property?
Usiness strategy game and strategy and policy : Personal and Social Responsibility - How can your work ethic, integrity, and reasoning benefit the greater community?
What is the difference between lost and abandoned property : How has the Internet made problems for owners of intellectual property?

Reviews

len1471643

4/24/2017 2:11:57 AM

Please see pdf file and implement it. Please download the starter files for this assignment from the Files tab (Assignment8.zip). Do not alter the class definition or driver code in any way. Programs that crash are subject to a 50% penalty. Please submit the class header file only ("bst.h"). PLEASE NOTE: You may not use any Standard Template Library (STL) classes for this assignment; use code provided by the instructor only.

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