Create a class for a binary tree named bt

Assignment Help Data Structure & Algorithms
Reference no: EM131713730

Assignment

Create a class for a binary tree named BT. Each node in the tree should have data, a reference to the node's left sub-tree, and a reference to the node's right sub-tree. For the purposes of this project, the data in the nodes can be integers.

The binary tree should have a height property, a size property, which is the number of nodes in the tree, and the following methods:

1. a null constructor

2. a constructor that builds a tree from a specified array of integers. The tree does not need to be a balanced tree.

Note: remember to address the height and size properties when building a tree from a specified array.

1. preorder -- iterate ( list all nodes in order according to the preorder traversal of the tree)
2. inorder -- iterate ( list all nodes in order according to the inorder traversal of the tree)
3. postorder -- iterate ( list all nodes in order according to the postorder traversal of the tree)
4. search -- given a key value, tell us whether or not the integer is in the tree.
5. max -- return the maximum value in the tree
6. min -- return the minimum value in the tree
7. insert
8. delete
9. destroy

Test each method to ensure that it works properly.

Reference no: EM131713730

Questions Cloud

What are the barriers to change our healthcare system : What are the barriers to change our healthcare system from a curative approach to a preventative one
Problems faced by immigrants : Just as today, the late 19th and early 20th century witnessed a huge wave of immigration. Are there similarities in the problems faced by immigrants?
Themes relative to the civilizations : "Egyptian Culture "What is the importance of these themes relative to the civilizations at the time? How do these themes manifest themselves in works of art?
Discuss the inquisitors interrogation of veronese : Do you agree with the Inquisitor's interrogation of Veronese about his painting, originally titled Last Supper
Create a class for a binary tree named bt : Create a class for a binary tree named BT. Each node in tree should have data, a reference to node's left sub-tree and a reference to the node's right sub-tree.
What were the main things europeans wanted : In Southern Africa, what were the main things Europeans wanted? How did they make Africans work for them?
Discuss with respect to change agents : With respect to change agents, should organizations use internal or external change agents
What did british colonialism do with the benin bronzes : What did British colonialism do with the Benin Bronzes? What did Queen Elizabeth do with the Benin Bronzes?
How do our institutions affect economic activity : Identify authoritative academic, governmental, advocacy group, and media resources - Evaluate the quality of resources

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.

  Creating an object oriented data model

Create an object oriented data model, including all appropriate notations, to represent the given situation. In a particular region there are a number of gardens.

  Build a binary search tree

Build a binary search tree using the following set of numbers, preserving the orderin which they are given: 34,26,47,22,28,10,24,38,51,49,37,4,45,60,57,14.

  Identify the address of the entry in the third row

Identify the address of the entry in the third row and fourth column of the array, in the given problem. Identify the address of the entry in the third row and fourth column of the array.

  Implement the algorithm for count

Describe a most efficient algorithm to implement the algorithm for count(x, y). Derive the time complexity for your algorithm.

  Find the optimal location of the first-aid center

An industrial park consists of 16 buildings. The corporations in the park are sharing the cost of construction and maintenance for a new first-aid center.

  Find shortest path tree by bellman-ford-dijkstra algorithm

Find the shortest path tree from every node to node 1for the graph of following figure using Bellman-Ford and Dijkstra algorithm.

  Apply algorithm on string to make substrings

For instance, applying algorithm on string 37540 must make the following substrings (not necessarily in this order): 0; 3; 75; 54; 375; 540.

  Prove that g has a unique minimum spanning tree

Suppose you are given a connected graph G, with edge costs that are all distinct. Prove that G has a unique minimum spanning tree

  Find the first occurrence, the last occurrence

If numbers in a list aren't unique and therefore the largest number could occur more than once would the algorithm find the first occurrence, the last occurance? Every occurance?

  Create a data flow diagram of some given system

Create a data flow diagram of some system. Can use a real world example or a hypothetical one. Write a summary explaining the data flow diagram and trust boundaries.

  Create algorithm to calculate union of two input sets-array

Create algorithm to calculate union of two input sets given as arrays, both of size O(n). The output must be array of distinct elements that form union of the sets.

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