more topic chapters

Bubble Sort

Psuedocode

 #Coded by Revise Zone | Indenting is required
//ARRAY IS ALREADY PRESENT AND RECORED
SWAP←FALSE
MAX←10
n←MAX-1
//This means that the array has only 10 items
REPEAT
 SWAP←FALSE
 FOR COUNT ← 1 TO n
   IF ARRAYLIST[n]>ARRAYLIST[n+1]
           THEN
             TEMP←ARRAYLIST[n]
             ARRAYLIST[n]←ARRAYLIST[n+1]
             ARRAYLIST[n+1]←Temp
             SWAP←TRUE
   END IF
 n←n+1
UNTIL SWAP=FALSE 
 
			 

This sorting algorithm will only work for arrays that have numbers stores in it as there must be way to compare the weight of each value in each node. This could be improved for any sorting by converting characters to ASCII values but for school knowledge, this is enough...

Python Algorithm

The code is in python for this algorithm

The code is free for anyone to copy and use...The copied code must have the same code and indentation as above

Try it yourself




Download Py