subject

You are given as input an array a[1..n], with n entries. also, you know that, the array consists of a series of 0’s followed by a series of 1’s, but you don’t know how many of each there are. your goal is to find the first 1 in the array. there is a cost associated with checking the value of an entry in the array. each time you check a value and it turns out to be 0, you must pay 1 dollar. if value turns out to be 1, you have to pay 1 "famous algorithmist trading card (fatc)". in each of the parts of this question, you will have some number of dollars and some number of fatcs. you must give an algorithm which will return the index of the first (lowest indexed) 1 which works given your resources. for each part write pseudocode and explain why your algorithm works, given your resources.
(a) you have n dollars and n fatc
(b) you have 1 dollars and n fatc
(c) you have 10 log n dollars and 10 log n fatc
(d) you have 2 dollars and 10n.5 fatc
(e) you have k dollars and 10kn+/k fatc, for some constant k.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 06:00, hilarydodard7099
Which statistical function in a spreadsheet you to see how far each number varies, on average, from the average value of the list?
Answers: 2
image
Computers and Technology, 24.06.2019 07:40, daebreonnakelly
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
image
Computers and Technology, 25.06.2019 04:30, precioussmith76
What should be used when performing vehicle maneuvers?
Answers: 1
image
Computers and Technology, 25.06.2019 07:00, joey4843
What statement would cause polarization
Answers: 1
You know the right answer?
You are given as input an array a[1..n], with n entries. also, you know that, the array consists of...

Questions in other subjects:

Konu
Chemistry, 18.02.2020 20:33
Konu
Mathematics, 18.02.2020 20:34
Konu
Computers and Technology, 18.02.2020 20:34