[−][src]Function algorithmplus::sort::bubble_sort
pub fn bubble_sort<T: PartialEq + PartialOrd>(arr: &mut [T])
Sort an array using bubble sort
Parameters
arr
: A vector to sort in-place
Type parameters
T
: A type that can be checked for equality and ordering e.g. ai32
, au8
, or af32
.
Examples
use algorithmplus::sort::bubble_sort; let mut ls = vec![3, 2, 1]; bubble_sort(&mut ls); assert_eq!(ls, [1, 2, 3]);