sav

Sorting Algorithms Visualized
Index Commits Files Refs README LICENSE
sav.h (664B)
   1 #ifndef __SAV_H__
   2 #define __SAV_H__
   3 
   4 #include <time.h>
   5 #include <stdbool.h>
   6 
   7 #include "util.h"
   8 #include "array.h"
   9 
  10 #define SAV_DEFAULT_SORT_DELAY        5
  11 #define SAV_SORT_DELAY_MAX  500
  12 
  13 typedef enum {
  14     /* BUBBLE_SORT, */
  15     BUBBLE_SORT_IMPROVED,
  16     INSERTION_SORT,
  17     MERGE_SORT,
  18     QUICK_SORT,
  19     SHELL_SORT,
  20     SELECTION_SORT,
  21     HEAP_SORT,
  22     ALGORITHMS_COUNT
  23 } sort_t;
  24 
  25 typedef struct {
  26     Arr *arr;
  27     size_t sel, cmp, cmps, swps, its, B_used;
  28     time_t ti, tf;
  29     status_t status, prev_status, sort_status;
  30     sort_t sort_algo;
  31     size_t sort_delay;
  32 } SAV;
  33 
  34 status_t SAV_create(SAV **sav);
  35 void SAV_destroy(SAV *sav);
  36 
  37 void sort_reset_stats(SAV *sav);
  38 void sort_selector(SAV *sav);
  39 
  40 #endif