Presentation is loading. Please wait.

Presentation is loading. Please wait.

Vladimir Joanna Joel Eric Yoel Adriana Lance Aaron Divide into two problems.

Similar presentations


Presentation on theme: "Vladimir Joanna Joel Eric Yoel Adriana Lance Aaron Divide into two problems."— Presentation transcript:

1 Vladimir Joanna Joel Eric Yoel Adriana Lance Aaron Divide into two problems

2 Vladimir Joanna Joel Eric YoelAdrianaLanceAaron Sort each list recursively

3 VladimirJoannaJoelEricYoelAdrianaLanceAaron Sort each list recursively

4 VladimirJoannaJoelEricYoelAdrianaLanceAaron Merge the two lists

5 VladimirJoannaJoelEricYoelAdrianaLanceAaron Merge the two lists

6 VladimirJoannaJoelEricYoelLance Merge the two lists AaronAdriana

7 VladimirJoannaJoelYoelLance Merge the two lists AaronAdrianaEric

8

9 Counting Inversions 47621583 Divide into front and back halves 47621583 Count inversions within each half, and sort each half 24671358 3 4 Then, count inversions between front and back half

10 Counting Inversions between front and back 2467 1358 front: back: Merge. Whenever a back item is pushed up, count how many it goes past

11 Counting Inversions between front and back 2467 1358 front: back: Merge. Whenever a back item is pushed up, count how many it goes past skips over 2, 4, 6 and 7 Inversions: 4

12 Counting Inversions between front and back 2467 358 front: back: Merge. Whenever a back item is pushed up, count how many it goes past from front, nothing to count 1 Inversions: 4

13 Counting Inversions between front and back 467 358 front: back: Merge. Whenever a back item is pushed up, count how many it goes past from front, nothing to count 1 2 Inversions: 4

14 Counting Inversions between front and back front: back: Merge. Whenever a back item is pushed up, count how many it goes past 3 skips over 4, 6, and 7 1 2 Inversions: 7 358 467

15 Inversions: 4 Counting Inversions between front and back front: back: Merge. Whenever a back item is pushed up, count how many it goes past 3 skips over 4, 6, and 7 1 2 Inversions: 7 3 58 467

16 Inversions: 4 Counting Inversions between front and back front: back: Merge. Whenever a back item is pushed up, count how many it goes past 4 is in front: no change 1 2 Inversions: 7 3 58 4 67

17 Inversions: 4 Counting Inversions between front and back front: back: Merge. Whenever a back item is pushed up, count how many it goes past 5 moves past 6 and 7 1 2 Inversions: 9 35 8 4 67

18 Inversions: 4 Counting Inversions between front and back front: back: Merge. Whenever a back item is pushed up, count how many it goes past 5 moves past 6 and 7 1 2 Inversions: 9 35 8 4 67


Download ppt "Vladimir Joanna Joel Eric Yoel Adriana Lance Aaron Divide into two problems."

Similar presentations


Ads by Google