answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
frez
1 month ago
5

You are a police officer trying to crack a case. You want to check whether an important file is in the evidence room. Files have

IDs that are positive integers and the evidence room contains n files in sorted order of their IDs. Unfortunately, you do not have direct access to the evidence room; the only one who has access is Randy, who is corrupt and wants to make things hard for you. In the following we assume that x is the file ID you are looking for.
1. You know that the evidence room is organized as a sorted list of n elements. If Randy was not corrupt you would probably do binary search by asking him to give you the median file of the list. Unfortunately, you can only give Randy two indices l, u and he returns to you a file with index chosen uniformly at random from the range {l, . . . , u}. That is you can call

RANDY(l, u) = (i, ai), where i is a uniformly random integer chosen from l, . . . , u inclusive and ai is the ID of the corresponding file.

You solve the problem by doing something similar to binary search. You start by calling RANDY(1, n). Let’s assume that Randy returns (i, ai). You compare x to ai .

a.If x = ai you found the file you were looking for.
b.If x < ai you call RANDY(1, i − 1)
c.If x > ai you call RANDY(i + 1, n).

You continue recursively until you have either found the file or conclude that the file is not present in the evidence room. Show that the above algorithm accesses O(log n) files in expectation before it terminates.

2. With his trick in the previous question Randy was not able to slow you down very much1 . Now he decides to disallow "range" queries as above and only allows either sequential access to the files or access to a uniformly random file from the entire set. In particular, you now have two ways of accessing the list:

a.By looking at a uniformly random element of the list. That is by calling RANDY() = ai , where i is chosen uniformly at random from 1, . . . , n, inclusive.
Observe that you only receive the file ID, not the index of the file.

b.By asking Randy to give you the file directly following one he returned to you in some previous call. For example if you first call RANDY() and get back ai you are allowed to call NEXT(ai) and get back ai+1. Note that the list wraps around, so that NEXT(an) returns a1. If you haven’t already obtained ai in some previous call you may not call NEXT(ai).

To facilitate analyzing this setting, think of the files as being organized in the form of a circular sorted linked list where every file points to the one with the next higher ID.

(a) As a warm up, let us analyze the following setting. You are given a circle of unit circumference. You pick k points on the circle independently and uniformly at random and snip the circle at those points, obtaining k different arcs. Determine the expected length of any single arc. (Hint: Note that the length of each arc is identically distributed, so each has the same expectation. What is the sum of their expectations?)

(b) Develop a randomized algorithm for finding the file with ID x that makes at most O( √ n) calls to the functions NEXT() and RANDY() in expectation and always returns the correct answer. Analyze the running time of the algorithm. A proof of correctness is not necessary. (Hint: Your algorithm will perform some random accesses and some amount of linear search. Use part (a) to analyze the number of steps in the linear search)
Computers and Technology
2 answers:
Rzqust [894]1 month ago
4 0

Answer:

Answer:

RANDY operates randomly, therefore any file in the specified index range follows this recurrence relation:

T(n) = T(n-i) + O(1)

With the probability being 1/n where i is between 1 and n. The n in T(n) signifies the measurement of the index range which becomes (n-i) on the next iteration.

<pbecause i="" can="" range="" from="" to="" n="" with="" a="" probability="" of="" this="" results="" in="" the="" average="" time="" complexity="" as:="">

T(n) =

After solving for T(n) = T(n/2) + O(1)

It resolves to T(n) = O(log n)

Consequently, the time complexity for this algorithm is O(log n).

It is essential to recognize that this value indicates the average time complexity due to its randomized design. Conversely, in the worst-case scenario, the index range may reduce by just 1, leading to a time complexity of O(n) since T(n) in the worst case equals T(n-1) + O(1).

Explanation:

</pbecause>
Harlamova29_29 [932]1 month ago
3 0

Answer:

Since RANDY operates randomly, any file within the specified index range will have the recurrence relation as follows:

T(n) = T(n-i) + O(1)

Here, the probability is 1/n, where i can vary between 1 and n. The variable n in T(n) denotes the size of the index range, which will subsequently reduce to (n-i) in the following iteration.

Given that i is probabilistically distributed from 1 to n, the average case time complexity can then be expressed as:

T(n) = \sum_{i=1}^{n}\frac{1}{n}T(n-i) + O(1) = T(n/2)+O(1)

Next, solving T(n) = T(n/2) + O(1)

yields T(n) = O(log n).

Thus, the complexity of this algorithm is O(log n).

It should be noted that this represents the average time complexity due to the algorithm's randomized nature. In the worst-case scenario, the index range may only decrease by 1, resulting in a time complexity of O(n) since the worst-case scenario would be T(n) = T(n-1) + O(1).

You might be interested in
You want to register the domain name ABCcompany.org, but the registration service is not allowing you to do that. What's the mos
amid [805]

Options :

The domain name is already taken.

Domain names are required to end with ".com".

You do not hold legal ownership of ABC Company.

Domain names must exclusively use lowercase letters.

Answer:

The domain name is already taken.

Explanation: In the above scenario, ABCcompany.org signifies the domain associated with a specific individual or organization that leads to the owner's website. Each domain name must be unique; therefore, no two different entities or individuals can have identical domain names. Domains can have endings like .com, .org, .ng, and more, and they are not case-sensitive. Thus, the inability to register the mentioned domain is probably because it has already been claimed by someone else.

6 0
1 month ago
6. A small design agency you are consulting for will be creating client websites and wants to purchase a web server so they can
amid [805]

Answer:

Clarification:

The most effective recommendation for the agency would be to ensure they fully grasp the overall ownership costs of the server. This encompasses not only the server itself but also various factors including necessary software, an IT server manager, facility expenses, security investments, and backup options. Although these are key costs they will face, there may be additional unexpected expenses. Consequently, the best approach is to supply them with comprehensive information for making an informed decision.

3 0
18 days ago
You're installing two new hard drives into your network attached storage device. Your director asks that they be put into a RAID
8_murik_8 [892]

Response:

d. RAID 6

Clarification:

RAID is a technological method for data storage that integrates several physical hard drive components into a unified logical structure. Its primary purpose is to ensure both performance and data redundancy.

RAID 0 is focused on data striping, but it lacks redundancy.

RAID 1 enhances performance to nearly double but restricts disk space usage to around 50%.

RAID 5 offers both redundancy and improved performance, though it is constrained by smaller drive sizes.

RAID 6 provides redundancy as well but with a decrease in performance.

RAID 10 boosts both performance and data security.

Hence, RAID 6 is the optimal choice that emphasizes redundancy at the cost of speed.

8 0
1 month ago
When handling project scope creep, which are two things that all parties involved need to be aware of?
zubka84 [945]

Additional resources required for the projects

Added time necessary for the project

Clarification:

In any project management scenario, there will naturally be unexpected changes and additional needs, hence to successfully complete a project, one must allocate more time and resources. It is advisable that, based on the project specifics, the end user should maintain a sufficient buffer to accommodate any variations in human resources and the extra time necessary for project completion.

When planning the project, a consideration of extra time per each task is essential.

Every task within project management is categorized under distinct scopes of work.

3 0
27 days ago
An employee of a large corporation remotely logs into the company using the appropriate username and password. The employee is a
Natasha_Volkova [897]

Respuesta: Te proporcioné 6 opciones de las cuales puedes elegir.

Integridad

Escalabilidad

Calidad de Servicio

Tolerancia a Fallos

Redes de Línea Eléctrica

Seguridad

6 0
1 month ago
Other questions:
  • Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
    5·1 answer
  • Which of these is an example of the integrity principle that can ensure your data is accurate and untampered with?
    10·2 answers
  • In the middle of the iteration, how should a team handle requirement changes from the customer? (1 correct answer)
    7·2 answers
  • This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
    15·1 answer
  • Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in
    13·2 answers
  • What are the 2 things you are not sure about evaluating functions​
    7·2 answers
  • Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp
    6·1 answer
  • Explain why the cost of ownership may be lower with a cloud database than with a traditional, company database.
    9·1 answer
  • Write a program to help you feed your friends at a party by doing some math about square pizzas. Assume the grader defines a str
    12·1 answer
  • Exercise 8.1.9: Diving Contest Your school is hosting a diving contest, and they need a programmer to work on the scoreboard! Yo
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!