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 is the correct answer ?????
Damm [24]
<h3>Answer:  True</h3>

Explanation:

Technically you could isolate any variable you wanted, from either equation. However, convention is to pick the variable in which isolating it is easiest, and most efficient.

The key thing to look for is if there's a coefficient of 1. This is found in the second equation for the y term. Think of -4x+y = -13 as -4x+1y = -13. Due to the coefficient of 1, when solving for y we won't involve messy fractions.

If you were to solve for y, then you'd get y = 4x-13, which is then plugged in (aka substituted) into the first equation. That allows you to solve for x. Once you know x, you can determine y.

6 0
1 year ago
Tiana has already taken 1 page of notes on her own, and she will take 1 page during each hour of class. In all, how many hours w
Novosadov [1.4K]

Answer:

<u>42 Hours.</u>

Step-by-step explanation:

As an equation where y is the total pages and x is hours of class:

y=1+1x since she started with 1 page and does 1 page per hour.

Setting the total pages she needs as 43 (y=43) we get:

43=1+1x

Subtract one on both sides

42=1x

The 1 doesn't need to be written so

x=42

Therefore, it'll take her 42 hours to write all those notes.

4 0
3 years ago
Mr charidee took 80 mangoes to sell at the market . he sold 64 of the mangoes . what fraction of total mangoes did he sell . hel
Feliz [49]

Answer:\frac{4}{5}

Step-by-step explanation:

the fraction is \frac{64}{80} right, but notice that the numerator and denominator are both divisible by 16.

64 divided by 16 is 4,

80 divided by 16 is 5.

\frac{4}{5}

4 0
3 years ago
Read 2 more answers
You roll two number cubes, what is the probability of rolling two 5’s?
RoseWind [281]

10 i think i don't know how to deleat this so can u?

3 0
3 years ago
What is the value of g(−3) when g(x)=2x−2 ? Enter your answer in the box. g(−3)=
miss Akunina [59]
-8 is the answer if x=-3
6 0
3 years ago
Other questions:
  • What is the value of 4x^3+4x when x=4
    15·1 answer
  • How do you answer this MATH
    7·2 answers
  • Find the midpoint of the line segment with end coordinates of: ( 1 , 7 ) and ( 3 , − 2 ) Give coordinates as decimals where appr
    15·2 answers
  • The diagram shows the position
    15·1 answer
  • Two mechanics worked on a car. The first mechanic worked for 20 hours, and the second mechanic worked for 15 hours. Together the
    13·2 answers
  • HURRY WILL MARK BRAINLIEST .Diana is training for a marathon. The total miles she runs varies from week to week but follows the
    11·1 answer
  • 1. Find the area of each of the composite figures: <br> a) <br> 6 m <br> 8 m <br> 10 m
    12·2 answers
  • Can you explain how you got the answer as well please?
    11·2 answers
  • ((2x - 2)°<br> +o<br> 45°<br> o<br> The measure of the exterior angle of the triangle is
    10·1 answer
  • (Please help quick! will do brainliest!!)
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!