05demo-merge-invert

# 05demo-merge-invert - 1 10 14 18 19 3 7 16 17 23 25 2 11...

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

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

View Full Document

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

View Full Document

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

View Full Document

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: 1 10 14 18 19 3 7 16 17 23 25 2 11 Merge and Count Merge and count step. ■ Given two sorted halves, count number of inversions where a i and a j are in different halves. ■ Combine two sorted halves into sorted whole. two sorted halves auxiliary array Total: i = 6 2 10 14 18 19 3 7 16 17 23 25 2 11 Merge and Count Merge and count step. ■ Given two sorted halves, count number of inversions where a i and a j are in different halves. ■ Combine two sorted halves into sorted whole. i = 6 two sorted halves 2 auxiliary array Total: 6 6 3 10 14 18 19 3 7 16 17 23 25 2 11 Merge and Count Merge and count step. ■ Given two sorted halves, count number of inversions where a i and a j are in different halves. ■ Combine two sorted halves into sorted whole. two sorted halves 2 auxiliary array i = 6 Total: 6 6 4 10 14 18 19 3 7 16 17 23 25 2 11 Merge and Count Merge and count step. ■ Given two sorted halves, count number of inversions where a i and a j are in different halves. ■ Combine two sorted halves into sorted whole. two sorted halves 2 3 auxiliary array i = 6 Total: 6 6 5 10 14 18 19 3 7 16 17 23 25 2 11 Merge and Count Merge and count step. ■ Given two sorted halves, count number of inversions where a i and a j are in different halves. ■ Combine two sorted halves into sorted whole. two sorted halves 2 3 auxiliary array i = 5 Total: 6 6 6 10 14 18 19 3 7 16 17 23 25 2 11 Merge and Count Merge and count step. ■ Given two sorted halves, count number of inversions where a i and a j are in different halves. ■ Combine two sorted halves into sorted whole. two sorted halves 7 2 3 auxiliary array i = 5 Total: 6 6 7 10 14 18 19 3 7 16 17 23 25 2 11 Merge and Count Merge and count step. ■ Given two sorted halves, count number of inversions where a...
View Full Document

## This note was uploaded on 02/23/2012 for the course COMP 553 taught by Professor Ajay during the Spring '12 term at Ill. Chicago.

### Page1 / 25

05demo-merge-invert - 1 10 14 18 19 3 7 16 17 23 25 2 11...

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

View Full Document
Ask a homework question - tutors are online