subject

For each problem below, do not write pseudocode. Explain with words why your algorithm is correct and analyse its running time. Problem 1 (rating restaurants) You are writing a blog about restaurants in various cities. You have a list of the 16 top restaurants in La Habana but you don't trust the reviewer. You have a friend in there who is willing to help and all you want to do is provide the best of these 16 restaurants and the worst of these 16 restaurants. So you ask your friend to compare restaurants and give you her opinion on the best and the worst. (a) Briefly explain how your friend can help you doing 30 comparisons.
(b) Design an algorithm your friend can apply to help you if the list has n 2k many restaurants.
Your input is a list of n restaurants and your friend can compare any two in O(1) time. You want to output the best and the worst. Explain why your algorithm is correct and state and analyse its running time. Fastest (and correct) solutions worth more credit.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 17:30, granta1
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, yedida
File account. java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a string representation. note that the constructor for this class creates a random account number. save this class to your directory and study it to see how it works. then write the following additional code: 1. suppose the bank wants to keep track of how many accounts exist. a. declare a private static integer variable numaccounts to hold this value. like all instance and static variables, it will be initialized (to 0, since it’s an int) automatically. b. add code to the constructor to increment this variable every time an account is created. c. add a static method getnumaccounts that returns the total number of accounts. think about why this method should be static - its information is not related to any particular account. d. file testaccounts1.java contains a simple program that creates the specified number of bank accounts then uses the getnumaccounts method to find how many accounts were created. save it to your directory, then use it to test your modified account class.
Answers: 3
image
Computers and Technology, 24.06.2019 22:30, yaretxi
Telling a computer that is already on to turn again is known as what type of boot?
Answers: 1
image
Computers and Technology, 24.06.2019 23:00, alyssa337
What is a current gdp and what is a real gdp?
Answers: 1
You know the right answer?
For each problem below, do not write pseudocode. Explain with words why your algorithm is correct an...

Questions in other subjects:

Konu
Mathematics, 25.01.2021 03:10
Konu
English, 25.01.2021 03:10