
数据结构与算法
文章平均质量分 74
whm2300
这个作者很懒,什么都没留下…
展开
-
图的深度优先遍历,基于邻接链表的非递归实现
测试数据基于上图,新增4->1的路径。程序存在内存泄漏。 使用时可以修改depth_first_search第二个参数,指定开始遍历的结点。如果错误,欢迎指正!! #include #include using namespace std; /*************************************** * 图的深度优先遍历 * 基于邻接链表原创 2014-01-24 16:26:51 · 1057 阅读 · 0 评论 -
图的广度优先遍历,基于邻接链表实现
#include #include #include using namespace std; /*************************************** * * 图的深度优先遍历 * * 基于邻接链表的非递归实现 * **************************************/ typedef char vertex_t原创 2014-01-26 17:44:59 · 869 阅读 · 0 评论 -
字符串压缩
#include #include #include #include char *test(const char* str) { int i; int str_len = strlen(str); int num_of_char; //每次相同字符数目 char *pDes = (char*)malloc(str_len*2 +原创 2014-04-04 12:00:47 · 531 阅读 · 0 评论 -
字典树实现
字典树,插入时检测单词是否存在。原创 2014-04-22 15:28:18 · 552 阅读 · 0 评论