{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

exer7 - CMPT 307 Data Structures and Algorithms Exercises...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPT 307 — Data Structures and Algorithms Exercises on Divide and Conquer. Due: Thursday, November 19th (at the beginning of the class) Reminder: the work you submit must be your own. Any collaboration and consulting outside resources must be explicitly mentioned on your submission. 1. Recall the problem of finding the number of inversions. As in the class, we are given a sequence of n numbers a 1 , . . . , a n , which we assume are all distinct, and we define an inversion to be a pair i < j such that a i > a j . We motivated the problem of counting inversions as a good measure of how different two orderings are. However, one might feel that this measure is too sensitive. Let us call a pair a significant inversion if i < j and a i > 2 a j . Give an O ( n log n ) algorithm to count the number of significant inversions between two orderings. 2. Suppose you are consulting for a bank that is concerned about fraud detection, and they come to you with the following problem. They have a collection of n bank cards that they confiscated, suspecting them of being used in fraud. Each bank card is a small plastic object,
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern