
数据结构
飞蛾逐月
我们只能了解到部分的真相,但可以通过不断收集证据来完善我们对事物的观念。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
数据结构-字典(JavaScript)
直接上代码 function Dictionay() { this.datastore = new Array(); this.add = add; this.find = find; this.remove = remove; this.showAll = showAll; this.clear = clear; ...原创 2018-12-29 10:35:27 · 184 阅读 · 0 评论 -
PHP约瑟夫生者死者小游戏
30 个人在一条船上,超载,需要 15 人下船。于是人们排成一队,排队的位置即为他们的编号。报数,从 1 开始,数到 9 的人下船。如此循环,直到船上仅剩 15 人为止,问都有哪些编号的人下船了呢? $numberStart = 30; //开始的人数 $numberLive = 15; //最终剩下的人数 $numKill = 9; //"中奖"号码 $peopleList =...原创 2019-01-25 18:46:45 · 506 阅读 · 0 评论 -
数据结构-无向图搜索(JavaScript)
概念 算法 数据结构 描述 广度优先搜索 队列 通过将顶点存入栈中,顶点是沿着路径被探索的,存在新的相邻顶点就去访问 深度优先搜索 栈 通过将顶点存入队列中,最先入队列的顶点先被探索 当要标注已经访问过的顶点时,我们用三种颜色来反映它们的状态。 白色:表示该顶点还没有被访问。 灰色:表示该顶点被访问过,但并未被探索过。 黑色:表示该顶点被访问过且被完全探索过。 效果图 广度...转载 2019-03-22 17:28:53 · 435 阅读 · 0 评论 -
数据结构-图dijkstra(JavaScript)
function Graph(matrixOriginal = [], vertexName = []) { this.Dijkstra = function (start = 0) { let matrix = matrixOriginal; const rows = matrix.length,//rows和cols一样,其实就是顶点个数 ...原创 2019-06-05 11:31:11 · 350 阅读 · 0 评论 -
数据结构C-串的堆分配存储表示
代码实现 main.cpp #include<stdio.h> #include<stdlib.h> #define TURE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW -2 typedef int Status; // -----串的堆分...转载 2019-07-12 09:16:56 · 463 阅读 · 0 评论 -
数据结构C-串的块链存储表示
实现 #include <stdio.h> #include <stdlib.h> #include <string.h> #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW -2 #de...转载 2019-07-13 12:53:45 · 947 阅读 · 0 评论 -
数据结构C-二叉树的二叉链表存储表示
结点结构 二叉树的链表中的结点至少包含3个域:数据域和左、右指针域 代码实现 main.cpp #include<stdio.h> #include<stdlib.h> #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW ...原创 2019-07-13 12:54:07 · 13675 阅读 · 5 评论 -
数据结构C-串的定长顺序存储表示
代码实现 main.cpp #include <stdio.h> // printf(); scanf() #include <stdlib.h> // exit(); malloc() #include <time.h> // srand((unsigned)time(NULL)); #include <string.h> // 函数结果状...转载 2019-07-13 12:54:48 · 932 阅读 · 0 评论