-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsort.h
More file actions
55 lines (39 loc) · 1.29 KB
/
sort.h
File metadata and controls
55 lines (39 loc) · 1.29 KB
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
//
// Created by aurel on 13/05/2024.
//
#ifndef CDATAFRAME_PEREZ_LENAIN_BENSIFI_SORT_H
#define CDATAFRAME_PEREZ_LENAIN_BENSIFI_SORT_H
#include "column.h"
#define ASC 0
#define DESC 1
/**
* @brief: Sort a column according to agivenorder
* @param1: Pointer to the column to sort
* @param2: Sort type (ASC or DESC)
*/
void sort(COLUMN* col, int sort_dir);
/**
* @brief: Remove the index of a column
* @param1: Pointer to the column
*/
void erase_index(COLUMN *col);
/**
* @brief: Check if an index is correct
* @param1: Pointer to the column
* @return: 0: index not existing,-1: the index exists but invalid,
1: the index is correct
*/
int check_index(COLUMN *col);
/**
* @brief: Update the index
* @param1: Pointer to the column
*/
void update_index(COLUMN *col);
void create_index(COLUMN *col);
unsigned int partition(COLUMN* col, unsigned int left , unsigned int right, int sort_dir);
void quicksort(COLUMN* col, unsigned int left , unsigned int right, int sort_dir);
void swap(unsigned long long int *a, unsigned long long int *b);
int compare_in_col(COLUMN *col, unsigned long long int i , unsigned long long int j);
void insertion_sort(COLUMN *col, int sort_dir);
int compare_val_in_col(COLUMN *col, unsigned long long int i, void* val);
#endif //CDATAFRAME_PEREZ_LENAIN_BENSIFI_SORT_H