Created
June 14, 2014 15:00
-
-
Save zsrinivas/45c3d343a085018d71fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <stddef.h> | |
#include <math.h> | |
#include <string.h> | |
#include <ctype.h> | |
#include <time.h> | |
#include <assert.h> | |
#include <errno.h> | |
#include <limits.h> | |
#include <float.h> | |
#include <setjmp.h> | |
#include <signal.h> | |
int matrix[]={0,1,2,3,4,5,6,7,8}; | |
void seedrand() | |
{ | |
static int i=1; | |
if (i) | |
srand(time(NULL)); | |
i=0; | |
} | |
void swap(int *p, int *q) | |
{ | |
int temp; | |
temp=*p; | |
*p=*q; | |
*q=temp; | |
} | |
void shuffle(int *data, int low, int high) | |
{ | |
int j; | |
seedrand(); | |
if (low>=high) | |
return ; | |
j=rand()%(high-low) + low; | |
swap(data+low, data+j); | |
shuffle(data, low+1, j); | |
shuffle(data, j+1, high); | |
return ; | |
} | |
int main(int argc, char const *argv[]) | |
{ | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment