Exemple #1
0
int main(int argc, char **argv) {
  build_a_lst(*(argv+1));
  print_lst(head);    /* prints the table */
  int_radix_sort(head);
  printf("%s\n", "=====SORT=====");
  // print_lst(head);    /* prints the table but now sorted */
  return 0;
}
Exemple #2
0
int main(int argc,char **argv) {

  long int del_sec,del_msec;
  // struct timeval tv_s,tv_e;
  int group = 4;

  if (argc>1) n = atoi(argv[1]);
  else n = NELM;
  printf("n=%d\n",n);
  init_lst(lst,n);
  // print_lst(lst,n);

  // gettimeofday(&tv_s, NULL); 
  // selection_sort(lst,n);
  //  merge_sort(lst,tmp,n);

  int *src, * dest;

  src = lst;
  dest = tmp;

  // printf("%x  :  %x\n", src, lst);
  // printf("%x  :  %x\n", dest, tmp);

  //   printf("%x  :  %x\n", src, &lst);
  // printf("%x  :  %x\n", dest, &tmp);

  for (int iii = 0; iii < 32; iii += group) {
    int_radix_sort(src, dest, n, iii);
    
    int *temp;
    temp = src;
    src = dest;
    dest = temp;

  }

  //  float_radix_sort(lst,tmp,n);
  // gettimeofday(&tv_e, NULL); 

  /****
    PRINT elapsed time in sec and milli secs
  ****/

  // print_lst(lst,n);
  self_check(lst, n);
  return 0;
}