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
VMariaS [17]
3 years ago
6

Let t[1..n] be a sorted array of distinct integers, some of which may be negative. give an algorithm that can find an index i su

ch that 1 i n and t[i] = i
Mathematics
1 answer:
lisabon 2012 [21]3 years ago
8 0
Assuming we need to find i such that 
1 ≤ i ≤ n  and t[i]=i.

If we need to find only the first occurrence, we can do:

for i:1 to n {
    if t[i]=i then return(i)
}

If exhaustive search is required, then put the results (values of i) in an array or a linked list, return the number of values found, and the array (or linked list).


You might be interested in
Which ordered pairs are in a proportional relationship with (0.2, 0.3)?
MAXImum [283]

Answer:

C and E

Step-by-step explanation:

We are given that

x_1=0.2,y_1=0.3

\frac{y}{x}=\frac{0.3}{0.2}=\frac{3}{2}

k=\frac{y}{x}=\frac{3}{2}

A.x_2=1.2,y_2=2.3

\frac{y_2}{x_2}=\frac{2.3}{1.2}=\frac{23}{12}\neq=\frac{3}{2}

Hence, it is not in proportional relationship with (0.2,0.3)

B.(2.7,4.3)

x_3=2.7,y_3=4.3

\frac{y_3}{x_3}=\frac{4.3}{2.7}=\frac{43}{27}\neq\frac{3}{2}

Hence, it is not in proportional relationship with (0.2,0.3).

C.(3.2,4.8)

x_4=3.2,y_4=4.8

\frac{y_4}{x_4}=\frac{4.8}{3.2}=\frac{3}{2}

Hence, the ordered pair (3.2,4.8) are in a proportional relationship with (0.2,0.3).

D.(3.5,5.3)

\frac{y_5}{x_5}=\frac{5.3}{3.5}=\frac{53}{35}\neq \frac{3}{2}

Hence, the ordered pair (3.5,5.3) are not in a proportional relationship with (0.2,0.3).

E.(5.2,7.8)

\frac{y_6}{x_6}=\frac{7.8}{5.2}=\frac{3}{2}

Hence, the ordered pair (5.2,7.8) are in a proportional relationship with (0.2,0.3).

4 0
2 years ago
The Winkler family saved $100 month from the time Sarah was born until she started college. Sarah started collage on her 18th bi
Vlada [557]
4 year college Tuition: $28,800.00
Money Saved since Sarah was born: $21,600.00

So, no, her family did not save enough for college.
5 0
2 years ago
Read 2 more answers
Which would be the correct answer!
Blizzard [7]

Answer:

I think also option c ok

8 0
2 years ago
The area of a rectangular vegetable patch is 42 square meters. It is 7 meters long. How wide is it?
Lyrx [107]
42÷7=6 meters

I hope it helped!!!:)
7 0
3 years ago
Read 2 more answers
Can someone help me with 9,10,11 ?
sergij07 [2.7K]
I could be wrong but i graphed it out and 9 is C , 10 is A , and 11 is C Hopefully it's right
3 0
3 years ago
Other questions:
  • Keisha, Scott, and Ryan have a total of $101 in their wallets. Keisha has $6 more than Scott. Ryan has 3 times what Scott has. H
    10·1 answer
  • A total of 676 tickets were sold for the school play. They were either adult tickets or student tickets. There were 74 fewer stu
    10·1 answer
  • Enter the value of n so the expression (-y+ 5.3) + (7.2y-9) is equivalent to 6.2y+n.
    5·1 answer
  • Help please!!!<br><br> which graph represents the function f(x)=4/x?
    7·1 answer
  • How do you write 1 3/4 as a decimal show your work!
    6·1 answer
  • 0/0=? *please answer*
    12·1 answer
  • Can someone tell me if this is correct and if not tell me how to put it plzzzzzzzz
    10·1 answer
  • Q: Three planes are flying parallel to one another. The distance between plane 1 and plane 2 is half the distance between plane
    15·1 answer
  • CONSTANT In the expression 5-3b​
    10·1 answer
  • How do you describe the end behavior of a graph?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!