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
mixas84 [53]
3 years ago
7

Suppose that you are given a sorted sequence of distinct integers {a1,a2,…,an}. give an o(lgn) algorithm to determine whether th

ere exists an i index such as ai
Mathematics
1 answer:
jasenka [17]3 years ago
3 0
Since the sequence is sorted, you can use the binary search, which is of O(lg2).  You can google binary search, or inspire from the following.
Basically, the algorithm looks like the following:

checkMiddle(ai, a1,n)
if (n==0) return(-1)   // key ai not found
k=(1+n)/2;
if (a_k = ai)  return(k)
else
if (a_k>ai
   checkMiddle(ai,a_1,k)
else
  checkMiddle(ai,a_(k+1),n-k)
endif

You may have to tune and check, but the basic idea is there.

Also, concerning computing algorithms, you are better off with posting it under technology and computers.
You might be interested in
The figure below shows the quotient of fraction 3 over 5 Division sign fraction 2 over 5 using a rectangle model.
ICE Princess25 [194]
It should be 1 1/2 but not 100%sure
3 0
3 years ago
Read 2 more answers
1) Give an example of a research question that involves estimating a characteristic about the population of part-time students a
Strike441 [17]

Answer:1) what is the number of male part time students between the ages 15 - 19 years?

2) do students work more than 4 hours a day?

Step-by-step explanation:

7 0
3 years ago
7% interest on a loan of $800 for a year. how much will you receive?
alisha [4.7K]

Answer:

$56

Step-by-step explanation:

Here's an easy way to figure out this and any percentage question. One per cent (1 dollar out of $100) of $800 would be $8. So, if the man received 7 per cent out of $800, then just multiply $8 times 7, which is 56...so $56!

Hope it helps

Please mark me as the brainliest

Thank you

4 0
3 years ago
Read 2 more answers
I need help on this​
sdas [7]

Answer:

no

Step-by-step explanation:

yes

8 0
3 years ago
5. Order these from least to greatest.<br> 1/2,4/9, 2/3,5/6
stiks02 [169]

Answer: this is the correct order:    4/9,1/2,2/3,5/6

Step-by-step explanation:

7 0
3 years ago
Other questions:
  • Need help with this math​
    8·1 answer
  • A section of a roof is shaped like a triangle. The base of the triangle is 17 feet and the height is 9 feet. What is the area of
    7·1 answer
  • Find the slope of the line passing through the points 3,8 and -2,5
    13·2 answers
  • The measures of the angles of △ABC are given by the expressions in the table. Angle Measure A 48° B (6x−28)° C (2x)° Find the va
    11·2 answers
  • I need to know what is x ..................
    13·1 answer
  • there are 16 sixth graders and 20 seventh graders in the robotics club. Wants to organize the club members into equal size each
    11·1 answer
  • Wionna needs to average 5.8 from 14 judges. The mean score from 13 judges is 5.9. What is the lowest score she can receive from
    5·2 answers
  • The Trapezoidal rule Tn on the interval [0,5) will be exact for
    8·1 answer
  • Can someone help me please, i’ll give brainly. (10 points)
    11·1 answer
  • A rectangle has the height of X and the width of 7X -4
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!