Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can anybody answer those questions with explanation. (prefer typing instead of handwriting) or clean hand writing. please explaing all your steps if possible so i

can anybody answer those questions with explanation. (prefer typing instead of handwriting) or clean hand writing.
please explaing all your steps if possible so i can understand how to solve them.
image text in transcribed
3. Find the average runtime complexity of binary search procedure binary search (x: integer, 21,22,...,0, increasing integers) i:=1 {i is the left endpoint of interval) j:=n is right endpoint of interval) while i am then i :=m+1 else j :=m if x = a; then location=1 else location = 0 return location 4. Greedy strategy a. Does using the greedy algorithm for making change of n cents give a correct solution if a nickel was worth 6 cents instead of 5? (we have 1, 6, 10 and 25 cent coin denominations) b. We have n unique items. For i = 1,2,3,...,n, each item has a weight w >0 and value > 0. Write a greedy algorithm to find the maximum value of items that can be carried in a knapsack with a maximum weight capacity of W. An item may be broken into pieces and only a fraction put into the knapsack. It should take an array of weights, an array of item values and the weight limit of the knapsack as input. The array of weights and items are ordered such that w, corresponds to the same item as v

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions