General Webdev and Programming Stuff Algorithms Cheatsheet - everything you need to know

General Webdev and Programming Stuff Algorithms Cheatsheet

What is Bubble sort, and how to write an implementation of it in PHP

Bubble sort (aka 'sinking sort') is a basic sorting algorithm. It cycles through all items in the list, comparing one to the next item. If the next item is smaller than the current item it is looking at, their values get swapped. If any swap was made, the cycle starts again and until it goes through all items without doing any swaps.

I do not recommend that you ever code a bubble sort algo in PHP! Use the built in PHP functions, they will be much faster than (almost) anything coded in PHP. The core functions such as sort() (which uses an implementation of Quicksort) are coded in C, and are much faster than what you can do in PHP. This is just for educational reasons.

View More Details (and 8 discussions about this topic) Here...