Given a list of 4096 sorted values, about how many comparisons
can you expect to be...
Given a list of 4096 sorted values, about how many comparisons
can you expect to be performed to look for a value that's not in
the list using the
bubble sort algorithm?
We are given a non sorted array so that the values are not
pairwise disjoint (the same values may appear in many entries). Say
that we can find the k-th smallest element number in the array in
time O(n) for any 1 <= k <= n. Give an algorithm that finds
if there is a value that appears at least n/3 times.
Please explain the algorithm in words and analyze the run
time.
python3:
Given a list of numbers in order order, return a new list sorted
in non-decreasing order, and leave the original list unchanged.
function only
def mergeSort(inputArray):
#code here
a = [3,4,6,1,21,11,9,8]
b = mergeSort(a)
print('original array is: ', a)
print('sorted array is: ', b)
In Coral. Given a sorted list of integers, output the
middle integer .Assume the number of integers ia odd. Ex: if the
input 2 3 4 8 11 -1(a negative indicates end), the output is
4.
the maximum number of inputs for any test case should not exceed 9
positive values. If exceeded , output Too many inputs". Hint: Use
an array of size 9. First read the data into array.Then,based in
the number of items, find the middle item.
How
many occupations can you list that would need to use scientific
names for plants? How would these groups of people be affected by a
change in names for plants?
In C++
Given a sorted list of integers, output the middle integer. A
negative number indicates the end of the input (the negative number
is not a part of the sorted list). Assume the number of integers is
always odd.
Ex: If the input is: 2 3 4 8 11 -1
the output is:
Middle item: 4
The maximum number of inputs for any test case should not exceed
9. If exceeded, output "Too many numbers". Hint: First read the...
Consider the recursive formulation of the Binary Search
algorithm. Given a sorted and non-decreasing list of comparable
objects L, and a new item x, find the location (index) of x or
indicated that x is not in L.
5a) Give a recursive algorithm for binary search. No, while,
for, repeat etc statements are allowed. Only if, if else and
assignment statements are allowed.
5b) Write a difference equation for the running time of your
Binary Search algorithm. Solve your equation...