-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfileSort.h
56 lines (41 loc) · 1.17 KB
/
fileSort.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef FILESORT_H
#define FILESORT_H
/**
Author: Michael Tang
**/
//Libraries
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
//Global variables
int llist_length;
int sizeofFile;
//Linlist structure
typedef struct node
{
char str[512];
struct node *next;
}node;
typedef struct
{
node *head;
}linklist;
//linklist.c functions
void llist_push(linklist *llist, char *word);
void printList(linklist *llist);
//comparator.c functions
int stringCompare(void *string1, void *string2);
int numCompare(void *num1, void *num2);
//sort.c functions
int quickSort( void* toSort, int (*comparator)(void*, void*) );
void insertionSortHelp(linklist *sorted_list, node *new_node, int (*comparator)(void*, void*));
int insertionSort( void* toSort, int (*comparator)(void*, void*) );
node *getTail(linklist *p_list);
node *partition(node *head, node *end, node **newHead, node **newEnd, int(*comparator)(void*,void*));
node *quickSortRecur(node *head, node *end, int(*comparator)(void*,void*));
node *getTail(linklist *p_list);
node *getTailFromNode(node *head);
#define EMPTY_STR ""
#endif