1answer.
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
lawyer [7]
3 years ago
10

Using Sequential Search on an array of size n, the search key is definitely present in the array. The probability of matching th

e key to the nth item in the array is 1/3, and the probability of matching the key to the (n-1)st item is 1/2. The probabilities of matching each of the remaining items are all equal. What is the average case complexity function for Sequential Search under these conditions?
Computers and Technology
1 answer:
MissTica3 years ago
7 0

Answer:

(11n-5) / 12 is correct answer.

Explanation:

The Probability that key will match to nth term = 1/2

The Probability that key will match to n-1th term = 1/3

As all other probabilities are equal

The Total Probability that key matches to any of 1 to n-2 index = 1 - 1/2 - 1/3 = 1/6

The Probability that key matches to any of 1 to n-2 index = (1/6) / n-2 = (1/6)* (n-2))

Let P(i) = Probability that key matches to ith index.

The Average time complexity = 22 i=1 P(i) * i

The Average time complexity = 1/(6(n-2) * ( sum of 1 to n-2 ) + (n-1) / 3 + n/2

The Average time complexity = 1/(6(n-2) * ( n-2)*(n-1) / 2 + ( n-1) / 3 + n/2

The Average time complexity = 1/6 * (n-1)/2 + (n-1)/3 + n/2

The Average time complexity = (n-1)/12 + (n-1)/3 + n/2

The Average time complexity = (n-1 + 4 * n - 4 * 1 +6 * n)/12

The Average time complexity = 11n-5 / 12

so (11n-5) / 12 is correct answer.

You might be interested in
Which of the following is a true statement?
m_a_m_a [10]
Let me help you!
Did you know that both plants and animals undergo cellular respiration? The reason behind that is because both organims needs to get energy and to expel wastes.

Therefore, the correct answer for your question is: <span>C.Cellular respiration occurs in both plant and animal cells.

I hope that helped you! :></span>
4 0
3 years ago
What kind of loop repeats until something else (determined by the program) happens?
VLD [36.1K]

Answer:

The Condition-controlled loop

Explanation: Because its called a Condition and it does not stop untill something happens thats why its called "condition".

7 0
3 years ago
Read 2 more answers
A example of an <br> "ITERATIVE STATMENT"
timama [110]

Answer:

for(let i = 0: i <=5; i++) {

console.log(I)

}

Explanation:

An iterative statement repeats a body of code until the condition is not true. Here we declare an integer (i) and make it 0. Then the loop checks if the second part is true (i is less than or equal to 5), and if it is true, it executes the code inside the loop body, which logs i, and finally runs the last past, which increments i by one. When the second part becomes false, the loop exits.

7 0
2 years ago
COMO DEFINES LAS PALABRAS COMPUTADOR Y DISPOSITIVO? MENCIONA EJEMPLOS
Basile [38]

Explanation:

es una máquina digital programable que ejecuta una serie de comandos para procesar los datos de entrada, obteniendo convenientemente información que posteriormente se envía a las unidades de salida. Una computadora está formada físicamente por numerosos circuitos integrados y varios componentes de apoyo, extensión y accesorios, que en conjunto pueden ejecutar tareas diversas con suma rapidez y bajo el control de un programa (software).

3 0
3 years ago
Suppose we have a String object called myString. Write a single line of Java code
VikaD [51]

Answer:

myString=myString.toUpperCase();

Explanation:

In java to change all characters of a string to upper case we use .toUpperCase() method.It will convert string to upper case.

Implementation in java.

import java.util.*;

class Solution

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

Scanner scr=new Scanner(System.in);

System.out.print("Enter a string:");

String myString=scr.nextLine();

myString=myString.toUpperCase();

System.out.println("string in upper case : "+myString);

         }catch(Exception ex){

       return;}

}

}

Output:

Enter a string:hello

string in upper case : HELLO

5 0
3 years ago
Other questions:
  • You want to register the domain name ABCcompany.org, but the registration service is not allowing you to do that. What's the mos
    10·1 answer
  • Hard drives are usually self-contained, sealed devices. Why must the case for the hard drive remain sealed closed?
    8·1 answer
  • Given an array temps of double s, containing temperature data, compute the average temperature. Store the average in a variable
    14·1 answer
  • A folder has been shared with other users and set to read-only. What does this mean for users?
    12·2 answers
  • What is the term for the part of a browser responsible for reading and processing programming languages?
    10·1 answer
  • . Write programming code in C++ for school-based grading system
    8·1 answer
  • 75+ (43-54)<br> -12<br> 12<br> 41
    12·2 answers
  • What your favorite video game? (Put your user if you wanna play!)
    9·2 answers
  • What do you get with brainly points
    9·1 answer
  • What are the tools in creating an animation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!