Question

2. Do the following problems: Create a binary search tree (BST), with the following words inserted: Int, Char, Return, Break, Float, While, Short, Sort, Double, For, Continue. a. b. Insert the following words into the BST built in (a): Tree, Table, Binary, Network, Visit, Seekk, Traversal c. Where is the minimum key value in a BST? (Give a concrete example) d. Where is the maximum key value in a BST? (Give a concrete example) e. How many comparisons are needed to search for the key item Table in BST built in (b)? f. How many comparisons are needed to search for the key item Program in the BST built in (b)? g. Draw the shape of a BST with 15 nodes that requires the least possible number of comparisons

help

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

First four subparts have been solved as HOMEWORKLIB guidelines, please repost others.

c)

The minimum key in a BST is always present on the leftmost leaf node, like in the above example in the b part Binary is the smallest of them all.

The minimum value can also be the left sutree node of the root which has only right subtree and no children on the left hand side.

d)

In the above example While is the maximum key value.

The maximum key value will be of the node which is present in the right-hand side of the root, and it is either the rightmost leaf node or it is the node which has only left subtree in it.

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Add a comment
Know the answer?
Add Answer to:
help 2. Do the following problems: Create a binary search tree (BST), with the following words...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use the Binary Search Tree (BST) insertion algorithm to insert 0078 into the BST below. List...

    Use the Binary Search Tree (BST) insertion algorithm to insert 0078 into the BST below. List the nodes of the resulting tree in pre-order traversal order separated by one blank character. For example, the tree below can be described in the above format as: 75 53 24 57 84 77 76 82 92 0075 0053 0084 0024 0057 0077 OON 0076 0082

  • e Construct a binary search tree (BST) using the following array elements 60,63,15, 81,30,74,35,38,93,41,53,45,86,90). e For...

    e Construct a binary search tree (BST) using the following array elements 60,63,15, 81,30,74,35,38,93,41,53,45,86,90). e For the above BST, show the use of post-order traversal to delete node 53. . For the above BST, show the path to search the node 86 and to insert a node with key

  • Use the Binary Search Tree (BST) deletion algorithm to delete 0075 from the BST below. List...

    Use the Binary Search Tree (BST) deletion algorithm to delete 0075 from the BST below. List the nodes of the resulting tree in pre-order traversal order separated by one blank character. For example, the tree below can be described in the above format as: 75 53 24 57 84 77 76 82 92 0075 0053 0034 0024 0057 0077 0092 0078 0082

  • 8:08 33. Examine the following binary search tree and answer the question. The numbers on the...

    8:08 33. Examine the following binary search tree and answer the question. The numbers on the circles labels so that we can talk about the nodes, they are NOT values in the key members of the binary tree. (a). If an item is to be inserted into the tree whose key data member is less than the key data member in node 1 but greater than the key data member in node 5, where would it be inserted? (b) If...

  • Binary Search Tree Part A: The code attached in this document is a sample code to demonstrate ins...

    Binary Search Tree Part A: The code attached in this document is a sample code to demonstrate insert operation in binary search tree. Please fill in the missing part for the insert method to make the program work. The expected output should be as follows. 20 30 40 50 60 70 80 Part B: Find Lowest Common Ancestor (LCA) of a Binary Search Tree. According to WikiPedia definition , The lowest common ancestor is defined between two nodes v and...

  • Consider the given binary search tree (BST). 1. What is the maximum size of the array...

    Consider the given binary search tree (BST). 1. What is the maximum size of the array required to implement the above BST? 2. Draw the array-based binary tree that represents the given BST (use the Table tool above to draw the array or just write it on one line and explain it) 3. Print the given BST using the in-order traversal pattern (don't write code, just show the output) HTML Editor BIVA -A- IEE311 X, EE Do NVX 12pt Paragraph...

  • A Binary Search Tree is a binary tree where nodes are ordered in the following way:...

    A Binary Search Tree is a binary tree where nodes are ordered in the following way: each node contains one key (also known as data) the keys in the left subtree are less than the key in its parent node the keys in the right subtree are greater than the key in its parent node duplicate keys are not allowed Create a Binary Search Tree inserting the following list of numbers in order from left to right. 10,          6,           4,            8,            18,          15,          21 Please type...

  • Create a new Java Application that has the following methods: A method that generate a binary...

    Create a new Java Application that has the following methods: A method that generate a binary search tree (BST) where the number of nodes and the range of the values are from a file. A recursive method to print the BST in preorder traversal A recursive method to print the BST in post-order traversal A recursive method to print the BST in in-order traversal A recursive method to count the number of all nodes in BST A method to find...

  • Construct a Binary Search Tree (BST) program in C++. The program is required to: 1) load...

    Construct a Binary Search Tree (BST) program in C++. The program is required to: 1) load the BST from a dataset (I will provide the datasets-see below) in the order they exist in the dataset. 2) after the BST is built analyze the BST and display the following values: 2.1) the smallest branch height 2.2) the highest branch height 2.3) the number of nodes in the tree 2.4) the determination if the tree is balanced 2.5) the determination if the...

  • Needed in Java Code Create a Binary Search Tree with the following elements in the order...

    Needed in Java Code Create a Binary Search Tree with the following elements in the order mentioned below: 5, 85, 89, 3, 2, 8, 65, 92 1.Print the Pre-order of this tree 2. 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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT