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
In figure if AB is parrallel to CD,
lara31 [8.8K]

Answer:

Yes

Step-by-step explanation:

They are parallel lines basically, ingnore the measurements and the traingle, they were put there to confuse you.

Hope this helps

Never30

7 0
3 years ago
A club with 31 members is to select five officers (president, vice president, secretary, treasurer, and historian). In how many
Ksivusya [100]
If you take 31*5 that equals = 155 ways! <span />
5 0
3 years ago
When theres two negative nubers?are u suppose to add
Nina [5.8K]

Answer:

no

Step-by-step explanation:

6 0
3 years ago
Read 2 more answers
A box has 11 marbles, 3 of which are white and 8 of which are red. A sample of 4 marbles are selected randomly from the box with
aliina [53]

14/99

Select 1 marble; the chance that it is white is 4/12. Select a 2nd marble; the chance that it is white is 3/11. Select a 3rd; the chance it is white is 2/10. Select a 4th; the chance it is red is 8/9. Select a 5th; the chance it is red is 7/8. The chance of getting this specific set of 5 marbles in this order is (4/12)×(3/11)×(2/10)×(8/9)×(7/8)=(2×7)/(11×10×9).

This specific set could occur in the permutation of 5 things taken 5 at a time where 3 are identical (white), and the other 2 are also identical (red). The formula for this is 5!/(3!2!)=10.

Combining the chance of getting white, white, white, red, red with the number of ways 3 white and 2 red could have been distributed in the draw of 5 marbles gives the answer:

{(2×7)/(11×10×9)}×10=14/99

A similar process will show that the chance of getting 5 red marbles is 7/99; 4 white and 1 red is 1/99; 2 white and 3 red is 42/99; and 1 white and 4 red is 35/99.

6 0
2 years ago
How can you find the probability of a simple event if the total number of equally likely outcomes is 20?
dimaraw [331]
You can divide the total number of outcomes.
5 0
3 years ago
Other questions:
  • What is the vertex of the graph of y + 2x + 3 = –(x + 2)^2 + 1?
    15·2 answers
  • Help me with this only number 1
    6·1 answer
  • During a basketball game a player makes 12 of 18 free throws attempted write the ratio as fraction reduced to the lowest term
    11·2 answers
  • What is 2/3 simplified
    14·2 answers
  • If tan x=0.63 and cos x=0.83 , what does sin x =
    13·1 answer
  • Through (-9, -5), perpendicular to the y-axis.
    5·1 answer
  • Simplify the expression<br> 1 point<br><br> 3² x 4+5<br><br> 29<br> 54<br> 41<br> 81
    15·1 answer
  • Someone help pls, 3.12
    9·1 answer
  • Please help!!!!!
    14·1 answer
  • Solve the compound inequality <br><br> (Picture added, multiple choice)
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!