week6 merge and insertion sort

This commit is contained in:
2021-04-13 19:57:33 +08:00
parent 03c79f0b6c
commit 57d2fe1409
2 changed files with 178 additions and 0 deletions

27
week6/T6.h Normal file
View File

@@ -0,0 +1,27 @@
/*
* Author: Walter
* Student ID: 1930006025
* Week_6
* InsertionSort and MergeSort
*/
#include <stdbool.h>
#include <time.h>
/* insertion sort array A, with size n */
void InsertionSort(int *A, int n);
/* merge sort array A, start at left, end at right */
void MergeSort(int *A, int left, int right);
/* real merge sort function */
void _MergeSort(int *A, int *tmp, int left, int right);
/* merge function used in merge short */
void Merge(int *A, int *tmp, int lpos, int rpos, int rend);
/* check a sorted array */
bool Check(int *A, int size);
/* print one line to stdout about interval in ms */
void PrintClockInterval(clock_t start, clock_t end);