数据结构
文章平均质量分 79
住在半山腰的螃蟹
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
二叉树的深度、叶子数以及先、中、后、层次遍历
二叉树的深度、叶子数以及先、中、后、层次遍历 二叉树的深度是左右子树最大的 二叉树的叶子数,是度为0的结点的和 先序:先访问根结点,再访问左-右子树结点 中序:先访问左子树左结点,再访问根结点-右子树结点 后序:先访问左-右子树结点,再访问根结点 层次(俺们在这纠结许久……模拜大师):通过队列来进行访问,在进行队列初始化,根结点入队,通过队空来循环判断队空,再依次出队,左子树原创 2012-10-21 21:39:34 · 646 阅读 · 0 评论 -
STL_list的使用(转)
STL中list的使用: STL中的list就是一双向链表,可高效地进行插入删除元素。现总结一下它的操作。 文中所用到两个list对象c1,c2分别有元素c1(10,20,30) c2(40,50,60)。还有一个list::iterator citer用来指向c1或c2元素。 list对象的声明构造(): A. listc0; //空链表原创 2013-11-09 16:31:04 · 805 阅读 · 0 评论 -
循环单链表
#include #include typedef struct node { int data; struct node*next; }Snode; Snode* creat()//创建头结点 { int n,i,x; Snode *s,*t; Snode *head; head=(Snode*)malloc(sizeof(Snode));原创 2013-11-09 10:57:32 · 860 阅读 · 0 评论 -
循环双链表
#include #include typedef struct node { int data; struct node*next,*prior; }Snode; Snode* creat()//创建头结点 { int n,i,x; Snode *head,*s,*t; head=(Snode*)malloc(sizeof(Snode)); he原创 2013-11-09 10:49:46 · 797 阅读 · 0 评论 -
单链表头插法
#include #include typedef struct node { int data; struct node*next; }Snode; Snode* creat()//创建头结点 { int n,i,x; Snode *head,*s; head=(Snode*)malloc(sizeof(Snode)); head->next=N原创 2013-11-09 09:40:27 · 1356 阅读 · 0 评论 -
双链表
#include #include typedef struct node { int data; struct node*next,*prior; }Snode; Snode* creat()//创建头结点 { int n,i,x; Snode *head,*s,*t; head=(Snode*)malloc(sizeof(Snode)); he原创 2013-11-09 10:29:04 · 650 阅读 · 0 评论 -
线性表--单链表(尾插法)
#include #include typedef struct node { int data; struct node*next; }Snode; Snode* creat()//创建头结点 { int n,i,x; Snode *s,*t; Snode *head; head=(Snode*)malloc(sizeof(Snode));原创 2013-11-08 17:23:37 · 988 阅读 · 0 评论 -
线性表--顺序表
#include #define MAX 1000 typedef struct { int data[MAX]; int len; }Sqlist; void inint(Sqlist *l)//初始化顺序表 { int i,n; l->len=0; printf("请输入顺序表的元素的个数N\n"); scanf("%d",&n); for(i=0原创 2013-11-08 14:55:23 · 712 阅读 · 0 评论 -
HDU 1040 (各种方式排序)
As Easy As A+B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29961 Accepted Submission(s): 12821 Problem Description These days, I原创 2013-08-21 18:34:52 · 851 阅读 · 0 评论 -
STL_string(转)
basic_string::append 向string 的后面加字符或字符串。(比+=, push_back 更灵活) (1)向string 的后面加C-string basic_string& append( const value_type* _Ptr ); string s ( "Hello " ); // s=”Hello ” const char *c = "Out Ther原创 2013-11-09 16:54:29 · 746 阅读 · 0 评论
分享