Exercise: Base Syntax of PHP I
Illustrating sorts
PHP provides many sorting functions, efficient and simple to use.Unfortunately, these method are not well suited for the demonstration in front of the students. Therefore, it would be necessary to design a class which would show each step of the sorting process. This can be done within a web page as demonstrated in Bubble Sort and Quick sort demonstration.
For the bubble sort algorithm, you will need the following function:
count($arr) // Gives the number of items in the array $arrIf you are a skilled PHP programmer, you will program quick sort (see the algorithmic course for more details). You can program the recursive version, which is easier to program.
Solution
Related Pages
Contact
Prof. Dr. Emmanuel Benoist
Berner Fachhochschule - TI
Quellgasse 21
CH-2501 Biel/Bienne
Switzerland
Mail: emmanuel.benoist (at) bfh.ch
Berner Fachhochschule - TI
Quellgasse 21
CH-2501 Biel/Bienne
Switzerland
Mail: emmanuel.benoist (at) bfh.ch
Social Networks
Follow
me
on
Linkedin, Scholar
& Research gate