Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linked List and Selection Sort

Similar presentations


Presentation on theme: "Linked List and Selection Sort"— Presentation transcript:

1 Linked List and Selection Sort

2 Linked List

3 Linked List It is a data structure

4 Linked List It is a data structure

5 Linked List It is a data structure
Each element in a linked list is a node Each node consists of two parts: “pointer” and “data”

6 Linked List It is a data structure Dynamic
Can grow and be pruned while the program is running

7 Linked List It is a data structure Dynamic
Can grow and be pruned while the program is running

8 Linked List It is a data structure Dynamic
Needs not to be stored contiguously in memory

9 Linked List It is a data structure Dynamic
Needs not to be stored contiguously in memory Insert:

10 Linked List It is a data structure Dynamic
Needs not to be stored contiguously in memory Remove:

11 Linked List It is a data structure Dynamic
Needs not to be stored contiguously in memory Indexing

12 Selection Sort Select a “correct” value

13 Selection Sort Select a “correct” value
Divide the input list into two parts: Sorted and Unsorted

14 Selection Sort Select a “correct” value
Divide the input list into two parts: Sorted and Unsorted Initialize the sorted sublist is empty the unsorted sublist is the whole input list

15 Selection Sort Select a “correct” value
Divide the input list into two parts: Sorted and Unsorted Initialize Start Sorting (Iteratively)

16 Selection Sort Select a “correct” value
Divide the input list into two parts: Sorted and Unsorted Initialize Start Sorting (Iteratively) Finding the smallest value in the unsorted sublist

17 Selection Sort Select a “correct” value
Divide the input list into two parts: Sorted and Unsorted Initialize Start Sorting (Iteratively) Finding the smallest value in the unsorted sublist Add this smallest value to the sorted sublist

18 Selection Sort Select a “correct” value
Divide the input list into two parts: Sorted and Unsorted Initialize Start Sorting (Iteratively) Finding the smallest value in the unsorted sublist Add this smallest value to the sorted sublist Remove this value from the unsorted sublist

19 Selection Sort Select a “correct” value
Divide the input list into two parts: Sorted and Unsorted Initialize Start Sorting (Iteratively) Finding the smallest value in the unsorted sublist Add this smallest value to the sorted sublist Remove this value from the unsorted sublist Go back to the first step until the unsorted sublist is empty

20 Selection Sort

21 Selection Sort

22 Selection Sort


Download ppt "Linked List and Selection Sort"

Similar presentations


Ads by Google