130
E X E R C I S E # 4 2 : B U B B L E S O R T
bubbleSort([2, 0, 4, 1, 3])
→
[0, 1, 2, 3, 4]
Bubble sort is often the first sorting algorithm taught to computer science students. While it is
too inefficient for use in real-world software, the algorithm is easy to understand. In this last exercise
of the book, we’ll implement this basic sorting algorithm.
Dostları ilə paylaş: