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]
4 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:
MissTica4 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
Mightier than the waves of the sea is his love for you
Inessa05 [86]

cool but kinda creepy ngl

8 0
3 years ago
Jenna updated her status on a social network regarding her upcoming vacation. What information should Jenna not provide when upd
Helen [10]
Jenna should NOT provide her routine!!!
hope this helps and have a great day!!
7 0
3 years ago
Read 2 more answers
A triangular number is a number that is the sum of the integers from 1 to some integer n. Thus 1 is a triangular number because
neonofarm [45]

Answer:

  1. m = 3
  2. n = 20
  3. triList = []
  4. current = 0
  5. for i in range(1, n + 1):
  6.    current = current + i  
  7.    if(current >= m and current <= n):
  8.        triList.append(current)
  9. print(triList)

Explanation:

The solution code is written in Python 3.

Firstly, create variable m and n and set the value 3 and 20 to the variables (Line 1 -2)

Create a triangle number list (Line 4)  and another variable current to hold the value of current total of triangle number (Line 5).

Create a for loop and iterate through the number between m and n (Line 6).  Calculate the current total of triangle number (Line 7) and proceed to check if the current triangle number is bigger or equal to m and smaller and equal to n, add the current triangle number to triList (Line 8-9).

Print the triList (Line 11) and we shall get [3, 6, 10, 15]

4 0
3 years ago
Which model encourages pair programming to improve productivity?
san4es73 [151]

Answer:

Explanation:

Pair programming is an agile software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in. The two programmers switch roles frequently.

8 0
2 years ago
If a front passenger over 18 is not restrained by a seat belt, he or she is legally at fault. A. True B. False
inna [77]
The answer is A, True
7 0
3 years ago
Other questions:
  • AYUDAAA..... DARÉ TODOS LOS PUNTOS QUE PUEDA.
    15·1 answer
  • Can i configure my entire network as a dmz
    6·1 answer
  • The addElement operation for the linked implementation must determine the parent of the next node to be inserted. Why?
    5·1 answer
  • The producers of media messages want to get their information to?
    6·2 answers
  • Which of the following statements is false? People tend to shortcut security procedures because the procedures are inconvenient.
    13·1 answer
  • What’s the best description of an opportunity cost
    5·1 answer
  • For as long as you can remember, you've never been able to get a taco on Tuesday at your local taco truck. The lines are always
    8·1 answer
  • In order to manage information for a company, your website would need a/an
    6·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    12·1 answer
  • What are the different parts of a word processing program?<br><br> I need this ASAP please help!!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!