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
Linda Rove is paid $6.39 for each table she assembles. Last week she assembled the following number of tables. What was Roves pa
aleksandr82 [10.1K]
U dont really know what the answer is
7 0
3 years ago
A line with a slope of 3 passes through (2,5). Which choice is an equation of this line? Please help
jek_recluse [69]

Answer:

Top right.

Step-by-step explanation:

So we want a line with a slope of 3 and passes through (2,5).

To do so, we can use the point-slope form.

The point-slope form is:

y-y_1=m(x-x_1)

m is the slope and x₁ and y₁ is an ordered pair.

Thus, let m be 3, y₁ be 5, and x₁ be 2. Thus:

y-5=3(x-2)

Our answer is the top right :)

3 0
3 years ago
Read 2 more answers
Please answer ASAP!!!!
trasher [3.6K]

Answer:

2

Step-by-step explanation:

6 0
3 years ago
Read 2 more answers
What is one plus one<br>​
inna [77]

Answer:

2

Step-by-step explanation:

21 lol

7 0
3 years ago
Read 2 more answers
Solve using the quadratic formula<br><br> x^2-4x+1=0
sergiy2304 [10]

Answer:

x=2+ or - the square root of 3

Step-by-step explanation:

solve the equation for x by finding a, b, and c of the quadratic then applying the quadratic formula.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Instrument Panel
    12·1 answer
  • What two numbers multiply to get -28 and add to 12
    10·1 answer
  • What is the steps to solve 25 milligrams per day for one week
    10·1 answer
  • In a survey, a group of students were asked their favorite sport. Eighteen students chose “other” sports. Then how many students
    15·1 answer
  • The problems in this lesson review basic arithmetic skills.
    5·1 answer
  • A new car that sells for $44,000 depreciates 25% each year. Write a function that models the value of the car. Find the value of
    15·1 answer
  • Which trigonometric identity can be used to prove the given statement?<br> tan0 cos0 = sin0
    5·1 answer
  • At an appliance store, the price of a refrigerator is marked up 25% to $406.25.
    7·2 answers
  • Determine the equation of a circle with its centre at the origin in the Cartesian plane and with a radius of 2√3 units​
    13·1 answer
  • Yuto has a bag containing 3 red marbles, 5 blue marbles, 2 green marbles, and 8 yellow marbles. Rin reaches into the
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!