Saturday, November 2, 2013

Most Optimized Code for Sorting


Hi,

All of you must have come across statements and questions online or technical exams or placement exams asking for the MOST OPTIMIZED Code for sorting. Below I have shared a code to do that.
The Code is easy to understand and implement.

#include <stdio.h>
#include <math.h>

void createArray(int *array_players, int nlenght);
void createTournament(int *arry_players, int nlenght);
int findNextMax(int arry_players[], int nlenght);


int main()
{
    int i, arry_players[100], nlenght, max_value, nextMax_value, sorted_array[100];

    printf("Enter Number of Elements in Array ");
    scanf("%d",&nlenght);

    createArray(arry_players, nlenght);