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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
Jamie has to enter the names, employee id’s, and income of a group of employees into a worksheet. which option will jamie use to describe the data
Answers: 3
question
Computers and Technology, 23.06.2019 23:30
Worth 50 points answer them bc i am not sure if i am wrong
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
question
Social Studies, 18.07.2019 07:00
Questions on the website: 13722361