{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 3 - n 2 comparisons are performed to determine this What is...

This preview shows pages 1–8. Sign up to view the full content.

1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2
3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4
5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 Expected number of Inversions in Permutation. The ordered pair ( i,j ) is called inversion in a permutation of [1.. n ] if i < j but j precedes i in the permutation. For example the permutation 3 5 1 4 2 has six inversions (1,3), (2,3), (1,5), (4,5), (2,5), and (2,4). Find the expected number of inversion in a random permutation.
7 Average-Case Computational Complexity. We are given a real number x and a list of n distinct real numbers. The linear search algorithm locates x by successively comparing it to each element of the list terminating when x is located or determining x is not in the list. If x is i- th element, 2 i +1 comparisons are performed to locate x . If x

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n +2 comparisons are performed to determine this. What is the average-case computational complexity of this algorithm if the probability that x is in the list is p and it is equally likely that x is any of the n elements of the list? 8 Among 20 boxes 4 contain a prize. Jakub is randomly picking a box (one at the time and without returning it) until he finds a prize or has picked three boxes. What is the probability that Jakub finds a prize before picking third box? What is the probability that Jakub finds a prize in the first box if we know that if he would pick two boxes, he would find a prize?...
View Full Document

{[ snackBarMessage ]}

### Page1 / 8

3 - n 2 comparisons are performed to determine this What is...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online