Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.


CS301 Data Structures Assignment No 02 Spring 2020 Solution & Discussion

Problem Statement:

As you know, Binary Search Tree (BST) has property that on the addition of a node in the tree, we compare it with root node. If new node is less than root node, it can be added to the left sub-tree. Otherwise, it will be added to the right sub-tree. So, the BST will have numbers (or nodes) less than the root in the left sub-tree and the numbers greater than the root will be in the right sub-tree.

Following is a snapshot of Binary Search Tree (BST).






You are required to develop a C++ program implementing Binary Search Tree (BST) data structure for the above scenario.

For this you need to;

1.      Construct Binary Search Tree, based upon above given tree data
2.      Calculate minimum node (or number), maximum node, height and total number of nodes for BST   
Details:

Your solution must contain a tree node class named as TNode, insert() method, buildTree() method, minNode() method, maxNode() method, treeHeight() method and countNodes() method. You should call BuildTree() method in main() method and call insert() method inside BuildTree() method so that insert() method can actually add nodes in BST.

You must call the above-mentioned methods from main to calculate minimum node, maximum node, height and total number of nodes for the BST.

Remember, the height of root node is 1 while depth or level of root node is 0 in tree.

Views: 1261

Replies to This Discussion

CS301 Assignment # 2 Solution Spring 2020

please share the solution file

CS301 Assignment No 2 Solution 2020

CS301 Assignment NO.2 2020
it's compiled CPP file without any error.

RSS

Looking For Something? Search Below

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

Latest Activity

Ammara Sabir posted a status
"Jb muhabat hi nhi drmyan tu ;;;;;;;;;;;: wu rothein kya @@@ or hm mnaein kya"
1 hour ago
Ammara Sabir liked Honey Chaudhary's discussion Sabit to kar
1 hour ago
Ammara Sabir liked + ♥ Haniya khan's discussion (Bal-e-Jibril)
1 hour ago
Ammara Sabir liked Honey Chaudhary's discussion شور کروں گا اور نہ کچھ بھی بولوں گا
1 hour ago
Ammara Sabir liked + ♥ Haniya khan's discussion (Bal-e-Jibril)
1 hour ago
Ammara Sabir liked ♥Sυɠαɾ Gҽɳιυʂ♥'s discussion just feel
1 hour ago
+ ♥ Haniya khan liked ♥Sυɠαɾ Gҽɳιυʂ♥'s discussion just feel
6 hours ago
+ ♥ Haniya khan replied to ♥Sυɠαɾ Gҽɳιυʂ♥'s discussion just feel
6 hours ago

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service