The Gateway to Computer Science Excellence

+1 vote

An element is to be inserted in an array and the probability that it has been entered correctly is 0.9. Find the probability that the sorting algorithm worked correctly.

How to solve this type of questions?

How to solve this type of questions?

+2 votes

$\because$ It is given that we just have to insert 1 element in an array.

So $2$ cases arise

**case 1. **

The element is inserted at correct position. This means that the sorting algorithm worked correctly.

__case 2. __

The element is inserted at wrong position. This means that the sorting algorithm worked incorrectly.

So , we can say that the probability that the sorting algorithm worked correctly

= Probability of inserting the element at correct position

= $0.9$

52,345 questions

60,503 answers

201,884 comments

95,331 users