![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
文章平均质量分 78
Dream_WHui
光棍一个
展开
-
数据结构--循环队列
// circular queue.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui---------2015-1-25--------------------*/#include "stdafx.原创 2015-03-02 16:32:04 · 455 阅读 · 0 评论 -
数据结构--Floyd算法
// Floyd.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-16--------------------*///Floyd算法 最短路径#inclu原创 2015-03-02 17:36:09 · 603 阅读 · 1 评论 -
数据结构--稀疏矩阵(转置)
/ sparse matrix.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-3-------------------*/#include "stdafx.原创 2015-03-02 17:23:01 · 1188 阅读 · 0 评论 -
数据结构---图(数组表示法)
// MGraph_array.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-9--------------------*/#include "stdafx原创 2015-03-02 17:28:00 · 3631 阅读 · 0 评论 -
数据结构--队列
// queue.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui---------2015-1-25--------------------*/#include "stdafx.h"#inclu原创 2015-03-02 16:31:06 · 352 阅读 · 0 评论 -
数据结构--串
// string.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui---------2015-1-27-------------------*/#include "stdafx.h"#inclu原创 2015-03-02 17:22:19 · 531 阅读 · 0 评论 -
数据结构---图(邻接表)
// Graph_Adjacency List.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-12--------------------*/#includ原创 2015-03-02 17:29:55 · 2141 阅读 · 0 评论 -
数据结构--最短路径(Dijkstra算法)
// Dijkstra.cpp : Defines the entry point for the console application./*-----CODE FOR FUN------------------------CREATED BY Dream_Whui---------------2015-2-15--------------------*///最短路径 Dijkstra原创 2015-03-02 17:35:33 · 761 阅读 · 1 评论 -
数据结构--查找(静态查找表)
构造了次优先查找树// Nearly Optimal Search Tree.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-3-4----------------原创 2015-03-04 21:54:24 · 736 阅读 · 0 评论 -
C的free和C++的delete的区别
首先free对应的是malloc;delete对应的是new;free用来释放malloc出来动态内存,delete用来释放new出来的动态内存空间。应用的区别为:1. 数组的时候int *p=(int*)malloc(10*sizeof(int)) 释放的时候 free(p)即可;这是因为编译器对malloc做了一些特殊的处理,以保证可以正确释放内存。而当int *p=new int[1转载 2015-03-05 17:27:20 · 471 阅读 · 0 评论 -
数据结构--二叉序树
// Binary Sort Tree.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-3-5-------------------------*/ //二叉排序原创 2015-03-05 19:18:31 · 543 阅读 · 0 评论 -
数据结构--平衡二叉树
// Balanced Binary Tree.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-3-5-------------------------*/ //原创 2015-03-09 18:41:34 · 506 阅读 · 1 评论 -
B树 (插入操作)
B树B树的特性一颗m阶的B树满足一下特性(一) 树中的每个结点至多有m颗子树,至少有颗子树。(除根结点和叶子结点外),其中表示m/2向上取整。()(二) 树中的每个结点至少有个关键字,至多m-1个关键字。当结点的关键字个数满时,那么该结点就需要分裂,如何分裂?假设*p结点已经有m-1个关键字,当再插入一个关键字后,其关键字个数为m,超标了!分裂开始,将*p结点分裂成两个原创 2015-03-22 22:28:00 · 4692 阅读 · 0 评论 -
二叉树的深度优先遍历和广度优先遍历
转自:http://www.blogjava.net/fancydeepin/archive/2013/02/03/395073.html深度优先搜索算法(Depth First Search),是搜索算法的一种。是沿着树的深度遍历树的节点,尽可能深的搜索树的分支。当节点v的所有边都己被探寻过,搜索将回溯到发现节点v的那条边的起始节点。这一过程一直进行到已发现从源节点可达的所有转载 2015-04-02 15:08:43 · 470 阅读 · 0 评论 -
PAT 1003. 我要通过!
“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符;2. 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串原创 2015-10-28 18:45:00 · 481 阅读 · 0 评论 -
PAT 1005. 继续(3n+1)猜想
卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算3、5、8、4、2、1,则当我们对n=5、8、4、2进行验证的时候,就可以直接判定卡拉兹猜想的真伪,而不需要重复计算,因为这4个数已经在验证3的时候遇到过了,我们称5、8、4、2是被原创 2015-10-28 18:58:54 · 502 阅读 · 0 评论 -
二查排序树的基本操作(插入,删除,找前驱与后继)
// Binary-Search-Tree.cpp : Defines the entry point for the console application.//最近要面试,想自己写写这类算法的代码,加深印象#include "stdafx.h"//参考算法导论的伪代码编写//有错误的地方,恳请大家批评指正,thx;typedef struct Node{ int val; N原创 2016-09-27 12:28:28 · 1048 阅读 · 0 评论 -
数据结构--最小生成树(Prim算法)
头文件 Graph.h//以数组形式构造图#pragma once#include #include using namespace std;#define INFINITY INT_MAX#define NAX_VERTEX_NUM 20#define VRtype int//#define原创 2015-03-02 17:29:39 · 1295 阅读 · 0 评论 -
数据结构--二叉树(线索链表)
//// Threaded Binary Tree.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-6-------------------*/#includ原创 2015-03-02 17:26:26 · 753 阅读 · 0 评论 -
数据结构--广义表
// GList.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-5-------------------*/#include "stdafx.h"#inc原创 2015-03-02 17:25:41 · 691 阅读 · 0 评论 -
数据结构---图(求关节点)
// Find Articulation Point.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-13--------------------*/#inc原创 2015-03-02 17:30:56 · 2714 阅读 · 0 评论 -
数据结构--线性链表
// Liner linked list.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui---------2015-1-20--------------------*/#include "stda原创 2015-03-02 16:25:13 · 415 阅读 · 0 评论 -
数据结构--双端链表
// double linked list.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui---------2015-1-20--------------------*/#include "std原创 2015-03-02 16:27:51 · 411 阅读 · 0 评论 -
数据结构--稀疏矩阵(相乘)
// RLSMatrix.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-3-------------------*/#include "stdafx.h"原创 2015-03-02 17:24:07 · 5409 阅读 · 1 评论 -
数据结构--哈弗曼树
// Huffman.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-8-------------------*/#include "stdafx.h"#i原创 2015-03-02 17:27:45 · 852 阅读 · 1 评论 -
数据结构--关键路径
// Critical Path.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-15--------------------*///关键路径#inclu原创 2015-03-02 17:34:50 · 653 阅读 · 1 评论 -
数据结构---图的连通性
//头文件//以数组形式构造图#pragma once#include #include using namespace std;#define INFINITY INT_MAX#define NAX_VERTEX_NUM 20#define VRtype int//#define原创 2015-03-02 17:28:41 · 873 阅读 · 0 评论 -
数据结构--拓扑排序
// TopologicalSort.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-15--------------------*///拓扑排序#inc原创 2015-03-02 17:33:28 · 882 阅读 · 0 评论 -
数据结构--线性表
// Liner.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui---------2015-1-20--------------------*/#include "stdafx.h"#inclu原创 2015-03-02 16:27:06 · 429 阅读 · 0 评论 -
数据结构--迷宫
迷宫游戏的代码 主要方法,运用栈的思想Stack 头文件#include //#define SElemType int#define INIT_STACK_SIZE 100#define STACKINCREMENT 10#define TRUE 1#define FALSE 0原创 2015-03-02 16:29:17 · 838 阅读 · 0 评论 -
数据结构--银行模拟
头文件list.h#include "stdafx.h"#include #include "my.h"//#define ElemType char //定义链表中元素的类型typedef struct LNode //结点的结构{ ElemType data; LNode *next;}*Link,*Position;typedef stru原创 2015-03-02 17:19:45 · 1848 阅读 · 0 评论 -
数据结构--二叉树
// Binary Tree.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-6-------------------*/#include "stdafx.h原创 2015-03-02 17:27:09 · 394 阅读 · 0 评论 -
数据结构--线性链表(完整)
// Completed Linked List.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui---------2015-1-26-------------------*/#include "s原创 2015-03-02 17:17:32 · 698 阅读 · 0 评论 -
指向函数的指针
指向函数的指针分类: C++ 2009-01-31 18:37 3288人阅读 评论(3)收藏 举报string编译器算法任务指向函数的指针假定我们被要求提供一个如下形式的排序函数:sort( start, end, compare );start和end是指向字符串数组中元素的指针。函数sort()对于start和end之间的数组元转载 2015-03-02 17:18:13 · 418 阅读 · 0 评论 -
数据结构--十字链表(相加,创建)
// CrossList.cpp : Defines the entry point for the console application./*-----CODE FOR FUN----------------------CREATED BY Dream_Whui-------------2015-2-4-------------------*/#include "stdafx.h"原创 2015-03-02 17:24:38 · 880 阅读 · 1 评论 -
二查平衡树的插入与删除(四种旋转)
// AVL.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;//最近需要面试,写以下二查平衡树的插入,删除代码。加深印象,其中的难点是旋转问题。//有不正确的地方,恳请批评指正!typedef stru原创 2016-09-28 15:16:59 · 839 阅读 · 0 评论