Presentation is loading. Please wait.

Presentation is loading. Please wait.

D1 Algorithms Sorting algorithms. Bubble sort- repeated passes through a list of numbers by comparing and switching adjacent numbers Try for 16, 9, 4,

Similar presentations


Presentation on theme: "D1 Algorithms Sorting algorithms. Bubble sort- repeated passes through a list of numbers by comparing and switching adjacent numbers Try for 16, 9, 4,"— Presentation transcript:

1 D1 Algorithms Sorting algorithms

2 Bubble sort- repeated passes through a list of numbers by comparing and switching adjacent numbers Try for 16, 9, 4, 6,

3 Quick sort Try with 19, 9, 4, 6,

4 Exercise 1B

5 Exam questions

6

7

8

9 Bin packing algorithms packing with as few bins/boxes as possible BoxABCDEFGHIJ HEIGHT (M) 0.80.60.70.50.90.40.30.60.50.6

10 Full bin combinations only suitable for small problems BoxABCDEFGHIJ HEIGHT (M) 0.80.60.70.50.90.40.30.60.50.6 Example A + C 8+7=15 FULL BIN B + E6+9=15 FULL BIN H + J + G6+6+3=15 FULL BIN D + I + F 5+5+ 4=14REMAINING BIN

11 First fit algorithm taking the boxes in the order listed and place in the next box available A (8) BIN 1LEAVING 7 B(6) BIN 1LEAVING 1 C(7)BIN 2LEAVING 8 D(5)BIN 2LEAVING 3 E(9)BIN 3LEAVING 6 F(4)BIN 3 LEAVING 2 G(3)BIN 2LEAVING 0 H(6)BIN 4LEAVING 9 I (5) BIN 4LEAVING 4 J(6) BIN 5 LEAVING 9 Although this has led to a further bin being used it is an attempt for a good solution known as a HEURISTIC ALGORITHM FIRST FIT DECREASING ALGORITHM- REORDER BOXES USING A SORTING ALGORITHM FIRST THEN FOLLOW THE FIRST FIT ALGORITHM

12 EXERCISE 1C

13 Exam questions June 08 q1 June 10 q 3 Jan 11 q 2 Jan 12 q 5


Download ppt "D1 Algorithms Sorting algorithms. Bubble sort- repeated passes through a list of numbers by comparing and switching adjacent numbers Try for 16, 9, 4,"

Similar presentations


Ads by Google