随笔分类 - 数据结构
摘要:前序遍历 void preOrder(BiTree bt){ if (bt!=NULL){ BiTree Stack[maxSize]; int top = -1; Stack[++top]=bt; BiTree p; while (top!=1){ p=Stack[top--]; visit(p)
阅读全文
摘要:### 冒泡排序 ``` # Here two loops would be required in sorting, the first loop for iterating and the second loop for comparing. # 总是比较相邻的两个数,称为冒泡 void Bub
阅读全文
摘要:导入头文件 编写代码过程中,涉及动态内存分配等常用的函数,需要引入如下头文件 #include<stdio.h> #include<stdlib.h> 结构体定义 // 定义二分搜索树中节点结构体 typedef struct Node { int data; struct Node * left;
阅读全文
摘要:// 代码实现过程中使用到 java.util 中的包 import java.util.LinkedList; import java.util.Queue; public class BST<E extends Comparable<E>> { // 二分搜索树中存放的数据是可比较的 // 定义
阅读全文
摘要:1. 导入头文件 编写代码过程中,涉及动态内存分配等常用的函数,需要引入如下头文件 #include<stdio.h> #include<stdlib.h> 2. 结构体定义 len 表示初始化时的数组长度,队列的最大容量为len-1 typedef struct Queue { int * pDa
阅读全文
摘要:1. 导入头文件 编写代码过程中,涉及动态内存分配等常用的函数,需要引入如下头文件 #include<stdio.h> #include<stdlib.h> 2. 结构体定义 // 链表节点的结构定义 typedef struct Node { int data; struct Node * nex
阅读全文
摘要:1. 导入头文件 编写代码过程中,涉及动态内存分配等常用的函数,需要引入如下头文件 #include<stdio.h> #include<stdlib.h> 2. 结构体定义 // 链表的 Node 结构体 typedef struct Node { int data; struct Node *
阅读全文
摘要:1. 导入头文件 编写代码过程中,涉及动态内存分配等常用的函数,需要引入如下头文件 #include<stdio.h> #include<stdlib.h> 2. 结构体的定义 // 定义一个 结构体 typedef struct Node { int data; struct Node * nex
阅读全文
摘要:1. 导入头文件 编写代码过程中,涉及动态内存分配等常用的函数,需要引入如下头文件 #include<stdio.h> #include<stdlib.h> 2. 存储结构体的定义 顺序存储所使用的内存是连续的,本质就是使用数组来存储数据,定义的结构体中使用 pData 来存放添加的数据,pData
阅读全文
浙公网安备 33010602011771号