For each problem show all work. Homework must be submitted in a Word document
1. A binary search of a sorted array with 3 unique elements where the search is always successful can be viewed as an array with each element having a probability of being selected = 1/3 and the number of comparisons a binary search requires to find the element is shown inside the array.
Then the average number of comparisons would be A(3) = (1/3) [2 + 1 + 2] = 5/3
Find the A(7) for an array with 7 elements for the same binary search.
(a) Draw the 7-element array showing the number of comparisons needed to find each element.
(b) Determine A(7)
(c) Using what you learned from parts (a) and (b), find the summation expression for A(n). To simplify your work, assume that n = 2k – 1. Use k in your summation. Leave your answer in closed form in terms of n.
(d) Simplify your a(n) for large values of n.
2. Consider the algorithm below
Precondition: n is a non-negative integer
function f ( n )
{ temp = 0
if (n != 0)
{ for (i = 1; i <= 3; i++) temp = temp + n * f(n-1) return temp }
else return 1;
Solve for the closed form by repeated substitution
3. The recurrence relation is given as an = 2an-1 + 3an-2 Use the method linear homogeneous characteristic roots to solve for the closed form, with given initial conditions a0 = 2 and a1 = 4
(a) Find the general solution
(b) Find the Specific solution
(c) Use your closed form result to find a
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme