C++
文章平均质量分 75
tommyhill
这个作者很懒,什么都没留下…
展开
-
An implementation of the skip list data structure written in C++
/* The authors of this work have released all rights to it and placed itin the public domain under the Creative Commons CC0 1.0 waiver(http://creativecommons.org/publicdomain/zero/1.0/).THE转载 2014-06-02 00:25:49 · 977 阅读 · 0 评论 -
单链表的实现(不带头节点)
//单链表的操作 (不带表头节点)#include #include #include #define MALLOC(p,s) \if( !( (p) = malloc(s) ) ) { \ fprintf(stderr,"Insufficient memory.\n"); \ exit(EXIT_FAILURE); \}typedef struct listNo原创 2014-09-16 07:35:04 · 686 阅读 · 0 评论 -
程序员必须知道的10大基础实用算法及其讲解
原文链接转载 2014-09-26 20:14:24 · 388 阅读 · 0 评论 -
平衡二叉查找树:红黑树
平衡二叉查找树:红黑树原文链接红黑树的定义 红黑树是满足如下条件的二叉树:(1)每个结点都有颜色标记,要么是黑色,要么是红色(2)根结点是黑色的(3)叶子结点是黑色的(按《算法导论》和其他文献的说法是,这里的叶子结点指的是空结点)(4)红色结点的孩子必须是黑色的(5)从根结点到每一个叶子结点的路径上,黑色结点的个数相同。转载 2014-09-26 19:53:09 · 464 阅读 · 0 评论 -
字符串处理函数的实现
#include /* strcpy function */char *(strcpy)(char *_Restrict s1, const char *_Restrict s2){ /* copy char s2[] to s1[] */char *s;for (s = s1; (*s++ = *s2++) != '\0'; );return (s1)转载 2014-09-16 07:27:40 · 401 阅读 · 0 评论 -
队列的实现
//队列的实现#ifndef MINIQUEUE_H#define MINIQUEUE_H#include #include #include #include using std::string;//自定义异常类class underflowException : public std::exception {public: underflowException(co原创 2014-09-16 13:25:46 · 359 阅读 · 0 评论 -
使用段错误产生的核心转储文件进行调试
Segmentation fault occur when a program attempts to access memory not allowed. This is often caused by improper usage of pointers in the source code, dereferencing a null pointer as shown in the examp原创 2014-09-24 09:52:32 · 1522 阅读 · 0 评论 -
二叉树的非递归遍历
二叉树的非递归遍历 二叉树的非递归遍历 二叉树是一种非常重要的数据结构,很多其它数据结构都是基于二叉树的基础演变而来的。对于二叉树,有前序、中序以及后序三种遍历方法。因为树的定义本身就是递归定义,因此采用递归的方法去实现树的三种遍历不仅容易理转载 2014-09-26 20:06:25 · 366 阅读 · 0 评论 -
应用 Valgrind 发现 Linux 程序的内存问题
应用 Valgrind 发现 Linux 程序的内存问题如何定位应用程序开发中的内存问题,一直是 inux 应用程序开发中的瓶颈所在。有一款非常优秀的 linux 下开源的内存问题检测工具:valgrind,能够极大的帮助你解决上述问题。掌握 valgrind 的使用以及工作原理,能够有效地定位进而避免应用开发中的内存问题。5 评论:杨 经 (cdl转载 2014-09-20 22:22:16 · 325 阅读 · 0 评论 -
回文
/** palindrome.cpp * 回文是一个单词或词组不管从前还是从后开始读,结果都一样。例如"madam" * 编写一个程序接受来自命令行的一个字符串参数,使用上一个练习中 * 编写的字符串逆转函数reverse_str,打印出这个字符串是否是回文 * 如果位置对称的两个字母大小写不同,例如 "Civic"任然返回true * 使其能够忽略标点符号和空格例如 "Abl原创 2014-06-22 00:00:24 · 482 阅读 · 0 评论 -
跳跃表(skip list) 的实现
// myskiplist.cpp an implemention of skip list written in c++#include #include // to get the declaration of function memset#include #include #include using namespace std;const f转载 2014-06-02 17:05:03 · 678 阅读 · 0 评论 -
使用 DrMemory 发现内存编程错误
Dr Memory 简介Dr. Memory 是一个开源免费的内存检测工具,它能够及时发现内存相关的编程错误,比如未初始化访问、内存非法访问以及内存泄露等。它不仅能够在 Linux 下面工作,也能在微软的 Windows 操作系统上工作。不过,本文撰写时,DrMemory 仅能支持 32 位程序,这是它的一个巨大缺陷,但相信随着开发的进行,DrMemory 会推出支持 64 位程序的版本。转载 2014-10-12 17:25:26 · 814 阅读 · 0 评论