数据结构
qmAlin
这个作者很懒,什么都没留下…
展开
-
简单易懂的顺序栈实现2(之前篇的简单改写)
ALin带你学习栈的基本操作 #include"stdafx.h" #include<iostream> using namespace std; constexpr auto M = 5; struct SeqStack { int top;//用来记住栈顶 int S[M];//这里的栈的最大容量m是固定的,大家可以想想怎么改,才能创建一个自定义大小的栈?先自己...原创 2018-11-03 22:44:22 · 167 阅读 · 0 评论 -
简单易懂的顺序栈实现
#include"stdafx.h" #include<iostream> using namespace std; constexpr auto M = 5;//最多存放 int Stack[M];//顺序栈 int top;//栈顶 void InitiaStack(int &top) {//初始化 top =-1; cout<<"初始化了一个...原创 2018-11-02 11:17:59 · 219 阅读 · 0 评论 -
链栈实现
#include"stdafx.h" #include<iostream> using namespace std; struct Node; typedef struct Node *PNode; struct Node { int data; PNode node; }; struct LinkStack { PNode top; }; typed...原创 2018-11-04 13:02:20 · 231 阅读 · 0 评论 -
顺序队列实现1
#include"stdafx.h" #include<iostream> using namespace std; constexpr auto M = 8; int Queue[M]; int front, rear; void Chushi(int &front,int &rear){ front =0; rear = 0; } int isEmp...原创 2018-11-04 22:37:41 · 147 阅读 · 0 评论 -
直接插入排序
直接插入排序必须采取顺序存储 时间复杂度为O(n^2) 辅助记录空间temp 直接插入排序是稳定的排序算法 49 38 65 97 76 13 27 49 38 49 65 97 76 13 27 49 38 49 65 97 76 13 27 49 ...原创 2018-11-14 13:51:15 · 151 阅读 · 0 评论 -
选择排序
选择排序的基本方法是:每步将待排序记录中选出最小的纪录,顺序放在已排序的记录序列后面,直到全部排完。 在算法实现时,每一趟确定最小元素的时候会通过不断地比较交换来使得首位置为当前最小,交换是个比较耗时的操作。其实我们很容易发现,在还未完全确定当前最小元素之前,这些交换都是无意义的。我们可以通过设置一个变量min,每一次比较仅存储较小元素的数组下标,当轮循环结束之后,那这个变量存储的就是当前...原创 2018-11-14 17:59:22 · 89 阅读 · 0 评论 -
行为树 1节点实现
节点基类 using System.Collections; using System.Collections.Generic; using UnityEngine; /// <summary> /// 节点基类 /// </summary> [System.Serializable] public abstract class Node { public deleg...原创 2019-09-04 18:13:55 · 366 阅读 · 0 评论