
Code
轩辕夏禹
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
常见几个字符串函数实现代码
(1) size_t strlen(const char *str) { assert(str != NULL); unsigned int cnt = 0; while(*str++ != NULL) ++cnt; return cnt; } (2) char *strcpy(char *strDest, const *strSrc) { if(s原创 2014-08-20 21:36:41 · 753 阅读 · 0 评论 -
栈的C语言实现源码
struct Node; typedef struct Node* pNode; typedef pNode Stack; struct Node { ElemType elem; pNode next; } int IsEmpyt(Stack s) { return (s->next == NULL); } Stack CreateStack() { Stack s; if(原创 2014-08-27 17:09:08 · 796 阅读 · 0 评论 -
常见几个排序源码及二分查找源码
#include #include #include using namespace std; void swap(int &a, int &b) { int tmp = a; a = b; b = tmp; } //Quick_sort int Median3(int *a, int left, int right) { int c原创 2014-08-21 16:43:21 · 703 阅读 · 0 评论 -
二叉树的非递归遍历
二叉树是一种非常重要的数据结构,很多其它数据结构都是基于二叉树的基础演变而来的。对于二叉树,有前序、中序以及后序三种遍历方法。因为树的定义本身就是递归定义,因此采用递归的方法去实现树的三种遍历不仅容易理解而且代码很简洁。而对于树的遍历若采用非递归的方法,就要采用栈去模拟实现。在三种遍历中,前序和中序遍历的非递归算法都很容易实现,非递归后序遍历实现起来相对来说要难一点。 一.前序遍历 前序转载 2014-05-26 21:08:37 · 632 阅读 · 0 评论