Even more purity

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
cyboryxmen
Posts: 170
Joined: November 14th, 2014, 2:03 am

Even more purity

Post by cyboryxmen » March 3rd, 2019, 8:51 am

Code: Select all

auto quick_sort(List<int> list)
{
	if(!list.empty())
	{
		auto [middle, list_to_sort] = list.pop_front();
		
		auto [lower, upper] = list_to_sort.split(Int < middle);
		
		return merge(quick_sort(lower), middle, quick_sort(upper));
	}
	else
	{
		return list;
	}
}
Image
Zekilk

Post Reply