Given an array of foods, create a binary search tree. Then, make
a copy of that BST and balance it. Language is C++. Vectors
are not allowed.
The balance function definition: void balance(BST treeObj); and
then when writing the function: void BST::balance(BST treeObj)
where BST is a class. The function will be called in main like:
originalTree.balance(balancedTree);
C++
Instantiate a binary search tree object and create such tree
using elements of the sequence 8,3,10, 1,6,9, 14, 4,7, 13 with 8 as
root of the tree. Find maximum and minimum elements of the tree,
successor(10) and predecessor(13), print the inorder, postorder and
preorder traversal of the tree.
Create a Binary Search Tree for the following data and do
In-order, Preorder and Post-order traversal of the tree.
50, 60, 25, 40, 30, 70, 35, 10, 55, 65, 5
Write an algorithm to delete a node in Singly Linked
List
[12
Write an algorithm of Binary
Search
[10]
Write a program in ‘C’ to generate Fibonacci series using
recursion
[8]
JAVA PROGRAM
Create a Binary Search Tree with the following elements in the
order mentioned below:
5, 85, 89, 3, 2, 8, 65, 92
Print the Pre-order of this tree
Print the height and the balance factor of the nodes in the
order they were inserted (5, 85, 89, 3, 2, 8, 65, 92) in the form
of a table with three columns and 9 rows. Use column headers
“Node”, “Height”, and “Balance Factor” for the three columns
respectively. Use...
Binary Search Algorithm
a.) Create a Java application that utilizes the "Binary
Search Algorithm" presented in chapter 19 (NOT Java's
pre-built binarySearch() method from imported Java library) to
search for an integer in a random array of size 30 in the range of
0 to 1000 inclusive. You should use Java's random
number generator to randomize the numbers in your array.
b.) The application's main() method should display unsorted
array and sorted array, prompt user for a search
key, allow...
Prerequisite Knowledge
Understand binary search tree structure
Understand binary search tree operations
Understand binary search tree worst case and best case
time.
Learning Outcomes
Describe AVL tree structure
Trace and implement AVL tree operations
Explain and prove AVL tree performance
I was trying to implement a simple binary search tree using this
given class of bst in c++
public:
BST();
~BST();
void insertKey(int newKey);
bool hasKey(int searchKey);
std::vector<int> inOrder();
int getHeight();
however; i am still required to use another class for the nodes
as a pointer and i need to manage memory leak.
in main we should ask for the numbers we need to insert in the
binary search tree and also let the user end it with a letter...
Question - 1
Using the structural node and methods discussed in Binary
Search Tree lectures, create a method for the Binary Search Tree
that takes an unsorted input list and constructs a Binary Search
Tree based on its values. Any duplicate value will only appear once
on the tree. This method outputs a Binary Search Tree structure
(not an enumeration of the tree). Discuss method's Big-O notation.
Add proper and consistent documentation to identify code sections
or lines to clearly...
Question 2:
Create a method (sortTraversal) for a Binary Search Tree that
prints out the Binary Search Tree in ascending or deceasing order.
The order type is an input to the method and can be "ascending" or
"descending". The ascending input would return the node values of
the tree beginning with the smallest and ending with the largest,
descending returns the opposite. Discuss method's Big-O notation.
Add proper and consistent documentation to identify code sections
or lines to clearly identify...