-
Notifications
You must be signed in to change notification settings - Fork 1
/
list_sort.c
32 lines (29 loc) · 1.1 KB
/
list_sort.c
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
// Generic list sort related helpers.
//
// Author: Joe Zbiciak <[email protected]>
// SPDX-License-Identifier: CC-BY-SA-4.0
#include "list_sort.h"
#include "bui1_merge_sort.h"
#include "bui2_merge_sort.h"
#include "tdi1_merge_sort.h"
#include "tdi2_merge_sort.h"
#include "tdr1_merge_sort.h"
#include "tdr2_merge_sort.h"
#include "tdr3_merge_sort.h"
#include "tdq1_quick_sort.h"
// Actual table of sort functions. The registry points to this.
static const SortRegistryEntry sort_registry_entry[] = {
{ "Bottom-Up Iter. MergeSort 1", bui1_merge_sort },
{ "Bottom-Up Iter. MergeSort 2", bui2_merge_sort },
{ "Top-Down Rec. MergeSort 1", tdr1_merge_sort },
{ "Top-Down Rec. MergeSort 2", tdr2_merge_sort },
{ "Top-Down Rec. MergeSort 3", tdr3_merge_sort },
{ "Top-Down Rec. QuickSort 1", tdq1_quick_sort },
{ "Top-Down Iter. MergeSort 1", tdi1_merge_sort },
{ "Top-Down Iter. MergeSort 2", tdi2_merge_sort },
};
// Registry of sort functions.
const SortRegistry sort_registry = {
.length = sizeof(sort_registry_entry) / sizeof(sort_registry_entry[0]),
.entry = sort_registry_entry
};