What is the average time complexity for inserting an element into a binary search tree?
Search Results
Individual Exercises
Complete the following binary search method. Find the number num
in the array array
. Return -1 if the number is not found. You may assume...
Write an algorithm that takes an ArrayList and uses a recursive binary search to return both the index of a given String, or -1 if the...
Below is an implementation of binary search on a list of integers. Fill in the remaining lines to complete the method. You can always...
Below is an implementation of binary search on a list of objects of type T. In this case, you can assume that T will always extend...
The animated image below shows a traversal of a binary tree. Which type of traversal is it?
The animated image below shows a traversal of a binary tree. Which type of traversal is it?
The animated image below shows a traversal of a binary tree. Which type of traversal is it?
The image below shows an in progress inorder traversal. The nodes highlighted in purple have already been visited in order (e.g. 36 14 24...
The image below shows a binary tree. Which of the options below include only internal nodes?
The image below shows a binary tree. Which nodes are leaf nodes?
Complete the following binary search method on integers. Find the number search
in the array numbers
. Return the index of the element if...
Complete the following linear search method. Find the number search
in the array numbers
. If the number is found, return the index for...
Complete the following contains
method so it returns true
if the value being searched is found in the array, or false
otherwise. You must...
Complete the following linear search method. Find the number search
in the array numbers
. If the number is found, return the index for...
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the index for the...
Consider a linear search as shown below.
int linearSearch(int w, int[] num) { // linear search code here }
Assume you call this method...
Binary search is a more efficient search than linear search. Which one of these is true?
Write a method searchInLastN
that implements a linear search but only looks for values in the last positions, determined by the parameter...
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the string found....
Complete the following binary search method on characters. Find the character search
in the array letters
. Return the index of the...
What is the root node of the tree shown here?
How many internal nodes there are in the tree shown here?
What is the depth of the tree shown here?
Select all of the nodes that are children of node 10 in the binary tree shown here.