Common algorithms for sorting and searching