数据结构
Sunday
UE4 、工业仿真 、 Delta3D 、OpenGL、分布式仿真
展开
-
哈夫曼树 源代码
#include#include#includeusing namespace std;typedef struct node{ int weight; int parent; int lchild; int rchild;}H_node,*H_tree;void print(H_tree t,int n)原创 2010-04-18 00:18:00 · 1025 阅读 · 0 评论 -
A* 搜索算法
A* 寻路算法原文地址: http://www.gamedev.net/reference/articles/article2003.asp概述虽然掌握了 A* 算法的人认为它容易,但是对于初学者来说, A* 算法还是很复杂的。搜索区域(The Search Area)我们假设某人要从 A 点移动到 B 点,但是这两点之间被一堵墙隔开。如图 1 ,绿色是 A ,红色是 B转载 2013-03-30 11:50:02 · 2862 阅读 · 0 评论 -
严蔚敏-- 顺序栈的代码实现
#include#include#includeusing namespace std;//----------顺序栈的实现-------------#define STACK_INIT_SIZE 100#define STACKINCREAMENT 10#defi原创 2011-10-17 15:08:30 · 1779 阅读 · 1 评论 -
严蔚敏--线性表的链式表示和实现 代码
#include#include#includeusing namespace std;//----------线性表的动态分配链存储结构-------------#define LIST_INT_SIZE 100#define LISTINCREATMENT 10原创 2011-10-15 12:55:07 · 1982 阅读 · 0 评论 -
严蔚敏--线性表的顺序表示和实现 代码
#include#include#includeusing namespace std;//----------线性表的动态分配顺序存储结构-------------#define LIST_INT_SIZE 100#define LISTINCREATMENT 10原创 2011-10-14 22:57:52 · 2257 阅读 · 0 评论 -
堆排序
<br />#include<iostream>using namespace std;#define MAX 100int a[MAX]={1,2,3,4,5,6,7,8};// void sitf_up(int *A,int i){ bool done=false; if(i!=1){ while(!done && i!=1){ if(A[i]>A[i/2])swap(A[i],A[i/2]); else done=true;原创 2011-06-01 21:48:00 · 691 阅读 · 0 评论 -
最大公约数问题
int gcc(int a,int b){ int c; while(a%b) { c=a%b; a=b; b=c; } return b; }原创 2010-04-22 21:50:00 · 682 阅读 · 0 评论 -
平衡二叉树 详解
#includeusing namespace std;typedef struct TreeNode{ int data ; struct TreeNode * left; struct TreeNode * right; int height; int del;}TreeNode,*Tree;int GetHeight(Tree t){原创 2010-04-20 19:23:00 · 1112 阅读 · 0 评论 -
qsort函数应用大全
C中qsort对各种类型的数据进行排序C++学习 2008-08-14 22:34:40 阅读10 评论0 字号:大中小 订阅 一、对int类型数组排序int num[100];Sample:int cmp ( const void *a , const void *b ){return *(int *)a - *(int *)b;}qsort(原创 2010-04-20 09:34:00 · 669 阅读 · 0 评论 -
c++ 树模板
自个写的,写的不好,见笑了#include#includeusing namespace std;ifstream in("a.txt");template class tree{ struct node { T data; struct node*lchild,*rchild;原创 2010-04-18 00:27:00 · 1347 阅读 · 0 评论 -
平衡二叉树 构造方法
平衡二叉树 对于二叉查找树,尽管查找、插入及删除操作的平均运行时间为O(logn),但是它们的最差运行时间都是O(n),原因在于对树的形状没有限制。平衡二叉树又称为AVL树,它或者是一棵空树,或者是有下列性质的二叉树:它的左子树和右子树都是平衡二叉树,且左右子树的深度之差的绝对值不超过1。二叉树的的平衡因子BF为转载 2011-06-07 21:05:00 · 23232 阅读 · 0 评论