![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
excel_sn
这个作者很懒,什么都没留下…
展开
-
堆栈实现
#include <stdio.h> #include <stdlib.h> #include <memory.h> #include "stack.h" #ifdef __cplusplus extern "C" { #endif #ifdef STACK_LINK typedef struct stack{ int num; ...原创 2012-03-24 20:47:48 · 97 阅读 · 0 评论 -
循环队列实现(链表,数组)
#include <stdlib.h> #include <memory.h> #include "queue.h" #ifdef __cplusplus extern "C"{ #endif #ifdef QUEUE_LINK typedef struct queue{ int num; struct queue *next; }QUEU...原创 2012-03-24 20:49:12 · 522 阅读 · 0 评论 -
排序——插入排序
/* insertion-sort */ int insertion_sort(int* arr, unsigned int arrCount) { unsigned int iLoop = 0; unsigned int jLoop = 0; int numInsert = 0; if(arr == NULL) { return -1; } for(...原创 2012-03-25 21:24:39 · 77 阅读 · 0 评论 -
排序——分治法排序(合并)
没想到第二个就是个费劲的,最怕递归,加油! #include "sorts.h" #include <malloc.h> #include <stdlib.h> #include <memory.h> static void merge(int * arr, unsigned int p, unsigned int q, unsigned r...原创 2012-03-26 23:21:24 · 130 阅读 · 0 评论 -
排序——冒泡
今天是我最熟悉的冒泡法。。 int bubble_sort(int * arr, unsigned int arrLength) { unsigned int iLoop = 0; unsigned int jLoop = 0; int tempChange = 0; if(arr == NULL) { return -1; } for(iLoop =...原创 2012-03-27 23:11:15 · 67 阅读 · 0 评论 -
排序——插入排序(可通用)
今天学堆排序了,好长,没学完,所以充数一下,把第一天写的插入排序,写了一个通用版本,这个版本抽象成排序类型、类型大小比较、移动类型三种操作。从而理论上可以对任何数组进行排序(我考虑可以对结构体、字符串等,需要抽象成指针),权当练习吧。 typedef int (*COMPARE_KEYS)(const SORT_TYPE key1, const SORT_TYPE key2); type...原创 2012-03-28 22:45:27 · 123 阅读 · 0 评论 -
排序——堆排序
static void max_heapify(int * arr, unsigned int beginPos, unsigned int length) { unsigned int largest = 0; unsigned int left = 0; unsigned int right = 0; unsigned int tempPos = 0; int te...原创 2012-04-08 17:49:51 · 63 阅读 · 0 评论