subject

1. Design an algorithm that reveals some secret integer number from the set {1, 2, .. , n} by guessing random numbers within the given range until the secret number has been guessed. Numbers should be replaced after being guessed such that it is possible to guess 2 and then 2 again, assuming 2 is in the given range. The algorithm should return both the secret number as well as the number of guesses taken. 2. If possible, calculate the tightest Big-O approximation for the average runtime complexity of the algorithm from part (a). If it is not possible, explain why not. Note: assume that choosing a random number takes O(1) time.
3. If possible, calculate the tightest Big-O approximation for the worst case runtime complexity of the algorithm from part (a). If it is not possible, explain why not. Note: assume that choosing a random number takes O(1) time.
4. In a single run, is it possible that of the algorithm from part (a) finds the secret number in fewer guesses than standard binary search algorithm? If so, please provide concrete example of one such situation

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create the illusion of 3d in a 2d game
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
question
Computers and Technology, 24.06.2019 11:20
Print "censored" if userinput contains the word "darn", else print userinput. end with newline. ex: if userinput is "that darn cat.", then output is: censoredex: if userinput is "dang, that was scary! ", then output is: dang, that was scary! note: if the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.#include #include using namespace std; int main() {string userinput; getline(cin, userinput); int ispresent = userinput.find("darn"); if (ispresent > 0){cout < < "censored" < < endl; /* your solution goes here */return 0; }
Answers: 3
question
Computers and Technology, 24.06.2019 17:00
The length of time that a slide appears before automatically advancing to the next slide can be set in the timing group under the transitions tab. transition to this slide group under the transitions tab. timing group in the master slide view. transition to this slide group in the master slide view.
Answers: 1
You know the right answer?
1. Design an algorithm that reveals some secret integer number from the set {1, 2, .. , n} by guessi...
Questions
question
Social Studies, 20.06.2020 03:57
Questions on the website: 13722362