Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 0.561.121.170.322.787.423.147.71 Value 6.214.42 Iteration 0: step 0. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with.

Similar presentations


Presentation on theme: "1 0.561.121.170.322.787.423.147.71 Value 6.214.42 Iteration 0: step 0. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with."— Presentation transcript:

1 1 0.561.121.170.322.787.423.147.71 Value 6.214.42 Iteration 0: step 0. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

2 2 0.561.121.170.322.787.423.147.71 Value 6.214.42 Iteration 1: step 0. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

3 3 0.561.121.170.322.787.423.147.71 Value 6.214.42 Iteration 2: step 0. Insertion Sort 0.567.42 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

4 4 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 2: step 1. Insertion Sort 0.562.78 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

5 5 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 2: step 2. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

6 6 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 3: step 0. Insertion Sort 1.127.42 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

7 7 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 3: step 1. Insertion Sort 1.122.78 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

8 8 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 3: step 2. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

9 9 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 4: step 0. Insertion Sort 1.177.42 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

10 10 7.421.121.170.322.780.563.147.71 Value 6.214.42 23450189Array index67 Iteration 4: step 1. Insertion Sort 1.172.78 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

11 11 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 4: step 2. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

12 12 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 5: step 0. Insertion Sort 0.327.42 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

13 13 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 5: step 1. Insertion Sort 0.322.78 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

14 14 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 5: step 2. Insertion Sort 0.321.17 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

15 15 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 5: step 3. Insertion Sort 0.321.12 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

16 16 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 5: step 4. Insertion Sort 0.320.56 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

17 17 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 5: step 5. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

18 18 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 6: step 0. 6.217.42 23450189Array index67 Insertion Sort Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

19 19 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 6: step 1. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

20 20 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 7: step 0. Insertion Sort 4.427.42 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

21 21 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 7: step 1. Insertion Sort 4.426.21 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

22 22 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 7: step 2. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

23 23 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 8: step 0. Insertion Sort 3.147.42 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

24 24 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 8: step 1. Insertion Sort 3.146.21 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

25 25 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 8: step 2. Insertion Sort 3.144.42 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

26 26 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 8: step 3. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

27 27 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 9: step 0. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.

28 28 7.421.121.170.322.780.563.147.71 Value 6.214.42 Iteration 10: DONE. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with the one to its left if smaller. Property. After ith iteration, a[0] through a[i] contain first i+1 elements in ascending order.


Download ppt "1 0.561.121.170.322.787.423.147.71 Value 6.214.42 Iteration 0: step 0. Insertion Sort 23450189Array index67 Iteration i. Repeatedly swap element i with."

Similar presentations


Ads by Google