Sort Implementation Details

C :
sorting integer array A with size sz,
    // You will have to implement a compareFunction. Example shown below. 
    qsort(A, sz, sizeof(int), compareFunction);
    
    // Example of compare function 
    int compareFunction(const void* a, const void* b) {
        int value1 = *((int *)a);
        int value2 = *((int *)b);
        if (value1 < value2) {
            // Return -1 if you want ascending. 1 if you want descending. 
            return -1;
        } else if (value1 > value2) {
            // Return 1 if you want ascending. -1 if you want descending. 
            return 1;
        }
        return 0;
    }
C++
Sorting vector V,
    sort(V.begin(), V.end());
JAVA
    ArrayList<Integer> A = .... 
    Collections.sort(A);
PYTHON :
    l = [...]
    l.sort()

Serious about Learning Programming ?

Learn this and a lot more with Scaler Academy's industry vetted curriculum which covers Data Structures & Algorithms in depth.

Arrays Problems

Value ranges
Problem Score Companies Time Status
Max Min 150
17:31
Merge Intervals 225 78:57
Merge Overlapping Intervals 225 48:24
Arrangement
Hash search
Problem Score Companies Time Status
Occurence of Each Number 200 28:07
Space recycle
Problem Score Companies Time Status
Set Matrix Zeros 300 48:04
Maximum Sum Square SubMatrix 300 58:30
lock
Topic Bonus
Bonus will be unlocked after solving min. 1 problem from each bucket