Software Design and Development

Home > Software Design and Development > Core > Software Development Cycle > Standard Algorithms: Sorting

Sorting algorithms used in software solutions

Activity 1: Bubble sort

  1. Trace table BUBBLESORT

    ind

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    ele

    11

    3

    12

    5

    13

    4

    6

    14

    7

    8

    15

    1

    9

    2

    10

    P 1

    113

    11

    125

    12

    134

    136

    13

    147

    148

    14

    151

    159

    152

    1510

    15

    P 2

    3

    115

    11

    124

    126

    12

    137

    138

    13

    141

    149

    142

    1410

    14

    15

    P 3

    3

    5

    114

    116

    11

    127

    128

    12

    131

    139

    132

    1310

    13

    14

    15

    P 4

    3

    4

    5

    6

    117

    118

    11

    121

    129

    122

    1210

    12

    13

    14

    15

    P 5

    3

    4

    5

    6

    7

    8

    111

    119

    112

    1110

    11

    12

    13

    14

    15

    P 6

    3

    4

    5

    6

    7

    81

    8

    92

    9

    10

    11

    12

    13

    14

    15

    P 7

    3

    4

    5

    6

    71

    7

    82

    8

    9

    10

    11

    12

    13

    14

    15

    P 8

    3

    4

    5

    61

    6

    72

    7

    8

    9

    10

    11

    12

    13

    14

    15

    P 9

    3

    4

    51

    5

    62

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    P 10

    3

    41

    4

    52

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    P 11

    31

    3

    42

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    P 12

    1

    32

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    P 13

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    P 14

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    P 15

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15


  2. 13
Back to Sorting algorithms used in software solutions

Activity 2: Selection sort

  1. Trace table SELECTIONSORT in ascending order from the smallest element

    index

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    element

    11

    3

    12

    5

    13

    4

    6

    14

    7

    8

    15

    1

    9

    2

    10

    pass 1

    1*

    3

    12

    5

    13

    4

    6

    14

    7

    8

    15

    11

    9

    2

    10

    pass 2

    1

    2*

    12

    5

    13

    4

    6

    14

    7

    8

    15

    11

    9

    3

    10

    Pass 3

    1

    2

    3*

    5

    13

    4

    6

    14

    7

    8

    15

    11

    9

    12

    10

    pass 4

    1

    2

    3

    4*

    13

    5

    6

    14

    7

    8

    15

    11

    9

    12

    10

    pass 5

    1

    2

    3

    4

    5*

    13

    6

    14

    7

    8

    15

    11

    9

    12

    10

    pass 6

    1

    2

    3

    4

    5

    6*

    13

    14

    7

    8

    15

    11

    9

    12

    10

    pass 7

    1

    2

    3

    4

    5

    6

    7*

    14

    13

    8

    15

    11

    9

    12

    10

    pass 8

    1

    2

    3

    4

    5

    6

    7

    8*

    13

    14

    15

    11

    9

    12

    10

    pass 9

    1

    2

    3

    4

    5

    6

    7

    8

    9*

    14

    15

    11

    13

    12

    10

    pass 10

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10*

    15

    11

    13

    12

    14

    pass 11

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11*

    15

    13

    12

    14

    pass 12

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12*

    13

    15

    14

    pass 13

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13*

    15

    14

    pass 14

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14*

    15

Back to Sorting algorithms used in software solutions

Activity 3: Insertion sort

  1. Trace table INSERTIONSORT in ascending order from the minimum

    Index

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    element

    11*

    3

    12

    5

    13

    4

    6

    14

    7

    8

    15

    1

    9

    2

    10

    pass 1

    3

    11*

    12

    5

    13

    4

    6

    14

    7

    8

    15

    1

    9

    2

    10

    pass 2

    3

    11

    12*

    5

    13

    4

    6

    14

    7

    8

    15

    1

    9

    2

    10

    pass 3

    3

    5

    11

    12*

    13

    4

    6

    14

    7

    8

    15

    1

    9

    2

    10

    pass 4

    3

    5

    11

    12

    13*

    4

    6

    14

    7

    8

    15

    1

    9

    2

    10

    pass 5

    3

    4

    5

    11

    12

    13*

    6

    14

    7

    8

    15

    1

    9

    2

    10

    pass 6

    3

    4

    5

    6

    11

    12

    13*

    14

    7

    8

    15

    1

    9

    2

    10

    pass 7

    3

    4

    5

    6

    11

    12

    13

    14*

    7

    8

    15

    1

    9

    2

    10

    pass 8

    3

    4

    5

    6

    7

    11

    12

    13

    14*

    8

    15

    1

    9

    2

    10

    pass 9

    3

    4

    5

    6

    7

    8

    11

    12

    13

    14*

    15

    1

    9

    2

    10

    pass 10

    3

    4

    5

    6

    7

    8

    11

    12

    13

    14

    15*

    1

    9

    2

    10

    pass 11

    1

    3

    4

    5

    6

    7

    8

    11

    12

    13

    14

    15*

    9

    2

    10

    pass 12

    1

    3

    4

    5

    6

    7

    8

    9

    11

    12

    13

    14

    15*

    2

    10

    pass 13

    1

    2

    3

    4

    5

    6

    7

    8

    9

    11

    12

    13

    14

    15*

    10

    pass 14

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15*

Back to Sorting algorithms used in software solutions

Neals logo | Copyright | Disclaimer | Contact Us | Help