Question

In: Computer Science

Research the topic of binary search trees. Write a brief summary of your understanding of this....

Research the topic of binary search trees. Write a brief summary of your understanding of this. Design a simple program, using pseudocode, that performs a search of a binary search tree.. In your own words, explain how a binary search tree works using graph theory terminology. Construct a binary search tree for any alphabetically ordered list of five words. Represent it visually as a graph. Discuss any characteristics you note about the graph you created in part (d). In your discussion, make sure to address the following: What are the degrees of each vertex? Is it a complete graph? Is the graph planar?

Solutions

Expert Solution

Binary Search Tree is a node-based binary tree data structure which has the following properties:

· The left subtree of a node contains only nodes with keys lesser than the node’s key.

· The right subtree of a node contains only nodes with keys greater than the node’s key.

· The left and right subtree each must also be a binary search tree.

               

Pseudo code(algorithm)

If root == NULL

    return NULL;

If number == root->data

    return root->data;

If number < root->data

    return search(root->left)

If number > root->data

    return search(root->right)

Explanation in words

4 is not found so, traverse through the left subtree of 8

4 is not found so, traverse through the right subtree of 3

4 is not found so, traverse through the left subtree of 6 And then it found after 6

If the value is found, we return the value so that it gets propagated in each recursion step as shown in the image below.

If you might have noticed, we have called return search(struct node*) four times. When we return either the new node or NULL, the value gets returned again and again until search(root) returns the final result.

If the value is not found, we eventually reach the left or right child of a leaf node which is NULL and it gets propagated and returned.

Degrees of each vertex

Complete graph

Planar graph


Related Solutions

using empirical research checklist search for empirical article and write an annotation concise summary in your...
using empirical research checklist search for empirical article and write an annotation concise summary in your own words and APA format (1) Does breastfeeding help to reduce the risk of childhood obesity (2) a systematic review and meta-analysis of the effect of lifestyle modification on metabolic control in overweight children?
(The topic about citation) . Write a summary of a scientific topic at your choice in...
(The topic about citation) . Write a summary of a scientific topic at your choice in civil engineer.You should cite at least two different types of sources (Book, Article, report, website, etc).The citation may be a paraphrase or summary; the direct quotation should not exceed 10%.Use proper citation style, e.g.APA,The summary should not exceed one-page including the references ( on the program word 12 font size and single line space)Note:(1) Avoid plagiarism, copying and pasting.(2)I want the references that you...
Based on your understanding of the topic, conduct a research and create a report on the...
Based on your understanding of the topic, conduct a research and create a report on the political battle for universal healthcare in the United States. Your report should include the following elements: History of the national healthcare reform starting from the early days struggle for a national health plan to the present day. Political struggle to pass PPACA. Political impact of Medicare and Medicaid on the push for universal coverage. Major issues from the legislative and executive (presidential) perspective. Who...
Derive a recurrence for the number of degenerate binary search trees that can be generated from...
Derive a recurrence for the number of degenerate binary search trees that can be generated from a given sequence of n distinct elements. Recall that degenerate binary search tree contains no branches and thus is structurally similar to a linked list. You must make an argument to justify each component of your recurrence. Remember that all recurrences have base cases so do not forget to include a base case.
Write a function in Python that adds two Binary Trees together. The inputs of your function...
Write a function in Python that adds two Binary Trees together. The inputs of your function should be two binary trees (or their roots, depending on how you plan on coding this), and the output will be one Binary Tree that is the sum of the two inputted. To add Binary Trees together: Add the values of nodes with the same position in both trees together, this will be the value assigned to the node of the same position in...
Write a version of the binary search algorithm that can be used to search a string...
Write a version of the binary search algorithm that can be used to search a string vector object. Also, write a program to test your algorithm. (Use the selection sort algorithm you developed in Programming Exercise 12 to sort the vector.) Your program should prompt the user to input a series of strings, ending the input stream with zzz. The program should then prompt the user to search for a specific string in the list. If the string is found...
What is your understanding of mentoring? Why do nurses need mentors? Give a brief summary of...
What is your understanding of mentoring? Why do nurses need mentors? Give a brief summary of each section of this Paper. DO NOT copy-and-paste the paper. Mentoring in Nursing (1 points) Benefits of Mentoring (1 points) Mentoring Relationships (1.5 points) Characteristics of a Healthy Mentor-Mentee Relationship (1.5 points) Mentoring Cycle (1 points) Reflection in Mentoring (1 points) Barriers to Mentoring (1.5 points) Give a brief contrast of a tutor vs mentor, vs friend, vs instructor. (1.5 points)
Write a brief summary of the AIS used at your place of employment. If you are...
Write a brief summary of the AIS used at your place of employment. If you are not currently employed, you may use a previous employer or interview an acquaintance about the AIS used at his or her workplace. If you have not been employed, interview a friend or family member. Assume you are an accounting manager at this organization and, reflecting on the concepts covered in this course, describe the changes that you would make to the internal control structure....
In your own words, and based in your understanding on the topic, write a small paragraph...
In your own words, and based in your understanding on the topic, write a small paragraph about the purpose and importance of using half-adder and full-adder logic circuits, their differences, some potential applications, and why they are useful in digital system
Implement two methods, find() and replace() relating to Binary Search Trees. Both of these methods must...
Implement two methods, find() and replace() relating to Binary Search Trees. Both of these methods must be recursive functions. The signatures for the functions must be: /* This method takes a tree node and a key as an argument and returns the tree node if the key is found and returns null if the key is not found. */ BST find(BST T, char key) /* This method takes a tree node and a key as an argument and inserts the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT