C/C++
excel_sn
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
堆栈实现
#include <stdio.h>#include <stdlib.h>#include <memory.h>#include "stack.h"#ifdef __cplusplus extern "C" { #endif #ifdef STACK_LINKtypedef struct stack{ int num;...原创 2012-03-24 20:47:48 · 141 阅读 · 0 评论 -
循环队列实现(链表,数组)
#include <stdlib.h>#include <memory.h>#include "queue.h"#ifdef __cplusplusextern "C"{#endif#ifdef QUEUE_LINKtypedef struct queue{ int num; struct queue *next;}QUEU...原创 2012-03-24 20:49:12 · 584 阅读 · 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 · 119 阅读 · 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 · 178 阅读 · 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 · 107 阅读 · 0 评论 -
排序——插入排序(可通用)
今天学堆排序了,好长,没学完,所以充数一下,把第一天写的插入排序,写了一个通用版本,这个版本抽象成排序类型、类型大小比较、移动类型三种操作。从而理论上可以对任何数组进行排序(我考虑可以对结构体、字符串等,需要抽象成指针),权当练习吧。typedef int (*COMPARE_KEYS)(const SORT_TYPE key1, const SORT_TYPE key2);type...原创 2012-03-28 22:45:27 · 169 阅读 · 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 · 99 阅读 · 0 评论
分享