随笔 - 209  文章 - 190  评论 - 235  阅读 - 224万

文章分类 -  数据结构

二叉树的举例
摘要:#include "stdafx.h" #include "malloc.h" #include "stdlib.h" typedef char DataType; typedef struct Node { DataType data; struct Node *leftChild; struct Node *rightChild; }BiTreeNode; //初始化二叉树 void Init... 阅读全文
posted @ 2008-06-28 11:41 小顾问 阅读(551) 评论(0) 推荐(0) 编辑
队列
摘要:#include "stdafx.h" #include "malloc.h" #include "stdlib.h" typedef int DataType; typedef struct qnode { DataType data; struct qnode *next; }LQNode; typedef struct { LQNode *front; LQNode *rear; }LQu... 阅读全文
posted @ 2008-06-27 22:43 小顾问 阅读(244) 评论(0) 推荐(0) 编辑
堆栈的链表表示
摘要:#include "stdafx.h" #include "malloc.h" #include "stdlib.h" typedef int DataType; //定义结构体 typedef struct Node { DataType data; struct Node* next; }LSNode; //堆栈的初始化 void StackInitiate(LSNode **... 阅读全文
posted @ 2008-06-27 21:33 小顾问 阅读(255) 评论(0) 推荐(0) 编辑
线性表的链表表示
摘要:#include "stdafx.h" #include "malloc.h" #include "stdlib.h" void change(int *p,int *q) { int s=*p; *p=*q; *q=s; } int main(int argc, char* argv[]) { int a=1,b=2; printf("%d,%d",a,b); cha... 阅读全文
posted @ 2008-06-27 20:12 小顾问 阅读(386) 评论(0) 推荐(0) 编辑
关于排序的几种
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace datastruct { publ... 阅读全文
posted @ 2008-06-25 21:57 小顾问 阅读(252) 评论(0) 推荐(0) 编辑
关于递归C#
摘要:我们先看个简单的问题: 一列数的规则如下: 1、1、2、3、5、8、13、21、34...... 求第30位数是多少, 用递归算法实现。(C#语言) static void Main(string[] args) { Console.Write(Fibonacci(30)); Console.Read(); ... 阅读全文
posted @ 2008-06-25 21:45 小顾问 阅读(395) 评论(0) 推荐(0) 编辑
C#与数据结构--图的遍历
摘要:图的存储结构 图的存储结构除了要存储图中各个顶点的本身的信息外,同时还要存储顶点与顶点之间的所有关系(边的信息),因此,图的结构比较复杂,很难以数据元素在存储区中的物理位置来表示元素之间的关系,但也正是由于其任意的特性,故物理表示方法很多。常用的图的存储结构有邻接矩阵、邻接表、十字链表和邻接多重表。 8.2.1 邻接矩阵表示法 对于一个具有n个顶点的图,可以使用n*n的矩阵(二维数组)来表示它们... 阅读全文
posted @ 2008-06-25 21:26 小顾问 阅读(964) 评论(0) 推荐(0) 编辑
C#与数据结构--二叉树的遍历
摘要:二叉树的存储结构 二叉树的存储可分为两种:顺序存储结构和链式存储结构。 1. 顺序存储结构 把一个满二叉树自上而下、从左到右顺序编号,依次存放在数组内,可得到图6.8(a)所示的结果。设满二叉树结点在数组中的索引号为i,那么有如下性质。 (1) 如果i = 0,此结点为根结点,无双亲。 (2) 如果i > 0,则其双亲结点为(i -1) / 2 。(注意,这里的除法是整除,结果中的小数部... 阅读全文
posted @ 2008-06-25 21:07 小顾问 阅读(708) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示