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

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

View Full Document Right Arrow Icon
1
Background image of page 1

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

View Full DocumentRight Arrow Icon
2
Background image of page 2
3
Background image of page 3

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

View Full DocumentRight Arrow Icon
4
Background image of page 4
5
Background image of page 5

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

View Full DocumentRight Arrow Icon
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.
Background image of page 6
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 is not in the list 2
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
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

This note was uploaded on 04/11/2011 for the course MACM 201 taught by Professor Marnimishna during the Spring '09 term at Simon Fraser.

Page1 / 8

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

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online