Tag Archives: quicksort
Pass a STL Array of fixed size as a parameter to another function without declaring the size in the function signature or prototype
There are two ways of doing this. You can either pass in a pointer/reference to the array along with it’s size to the function. #include <iostream> #include <array> void swap(int *arr, int a, int b) { auto t = arr[a]; arr[a] = arr[b]; arr[b] = t; } int partition(int *arr, int low, int high) { […]
0
QuickSort Algorithm in Java
Was plying over the fastest in-place non-stable sorting algorithm >> non-randomized version of QuickSort (Never mind the O^2 worst case! :)) ) I have attached a java implementation of the same algorithm alongside. QuickSortAlgo.java (Replace the “.java_.txt” extension to “.java” before using the file)
Login