随笔分类 -  数据结构

摘要:该文章对比了常用的一些存储底层所使用的数据结构。 1.B+树 MySQL,MongoDB的索引使用的就是B+树 B+树在多读少写(相对而言)的情境下比较有优势。 B+树的主要优点: 1.结构比较扁平,高度低(一般不超过4层),随机寻道次数少; 2.数据存储密度大,且都位于叶子节点,查询稳定,遍历方便 阅读全文
posted @ 2021-03-04 16:02 tonglin0325 阅读(36) 评论(0) 推荐(0) 编辑
摘要:又称单词查找树,Trie树,是一种树形结构,是一种哈希树的变种。 典型应用是用于统计,排序和保存大量的字符串(但不仅限于字符串),所以经常被搜索引擎系统用于文本词频统计。 它的优点是:利用字符串的公共前缀来减少查询时间,最大限度地减少无谓的字符串比较,查询效率比哈希树高。 下面是字典树数据的Java 阅读全文
posted @ 2016-10-29 18:42 tonglin0325 阅读(483) 评论(0) 推荐(0) 编辑
摘要:带权图的最小生成树——Prim算法和Kruskal算法 带权图的最短路径算法——Dijkstra算法 阅读全文
posted @ 2016-10-13 22:52 tonglin0325 阅读(952) 评论(0) 推荐(0) 编辑
摘要:点 建立无权图,添加新的顶点,添加边,显示顶点,返回一个和v邻接的未访问顶点,无权图的深度搜索,广度搜索,基于深度搜索的最小生成树,删除顶点,有向图的拓扑排序 有向图的连通性,Warshall算法 主函数 阅读全文
posted @ 2016-10-13 22:25 tonglin0325 阅读(299) 评论(0) 推荐(0) 编辑
摘要:class Node_Heap{ public int iData; public Node_Heap(int iData) { //构造函数 super(); this.iData = iData; } public int getiData() { return iData; } public 阅读全文
posted @ 2016-04-17 21:40 tonglin0325 阅读(404) 评论(0) 推荐(0) 编辑
摘要:1.开放地址法 2.链地址法 阅读全文
posted @ 2016-04-13 18:42 tonglin0325 阅读(143) 评论(0) 推荐(0) 编辑
摘要:1.二叉树的遍历 前序遍历——根 左 右 中序遍历——左 根 右 后序遍历——左 右 根 2.二叉树的实现 class Stack_BinaryTree{ private int maxSize; //栈的长度 private Node[] stackArray; //创建栈的数组的引用 priva 阅读全文
posted @ 2016-04-11 16:48 tonglin0325 阅读(259) 评论(0) 推荐(0) 编辑
摘要:1.哈夫曼树 给定N个权值作为N个叶子节点,构造一棵二叉树,若该树的带权路径长度(WPL)达到最小,称这样的二叉树为最优二叉树,也称为哈夫曼树(Huffman Tree)。 哈夫曼树是带权路径长度最短的树,权值较大的结点离根较近。 参考:霍夫曼树(参考该文章中的概念,其中代码不对) 2.树的带权路径 阅读全文
posted @ 2016-03-31 19:37 tonglin0325 阅读(150) 评论(0) 推荐(0) 编辑
摘要:class DoublyLinkedList{ //双向链表 private Link_long first; private Link_long last; public DoublyLinkedList(){ //构造函数 this.first = null; this.last = null; 阅读全文
posted @ 2016-03-31 11:02 tonglin0325 阅读(293) 评论(0) 推荐(0) 编辑
摘要:class SortedList{ private Link_long first; public SortedList(){ //构造函数 first = null; } public void insert(long key){ Link_long newLink = new Link_long 阅读全文
posted @ 2016-03-30 22:09 tonglin0325 阅读(269) 评论(0) 推荐(0) 编辑
摘要:class FirstLastList_long{ private Link_long first; private Link_long last; public FirstLastList_long() { //构造函数 this.first = null; this.last = null; } 阅读全文
posted @ 2016-03-30 21:16 tonglin0325 阅读(468) 评论(0) 推荐(0) 编辑
摘要:class Link_long{ //链节点类 public long dData; public Link_long next; //链表中下一个节点的引用 public Link_long(long dData) { super(); this.dData = dData; } public v 阅读全文
posted @ 2016-03-30 21:12 tonglin0325 阅读(982) 评论(0) 推荐(0) 编辑
摘要:class FirstLastList{ private Link first; private Link last; public FirstLastList() { //构造函数 this.first = null; this.last = null; } public boolean isEm 阅读全文
posted @ 2016-03-30 16:47 tonglin0325 阅读(219) 评论(0) 推荐(0) 编辑
摘要:<1>链表 <2>引用和基本类型 <3>单链表 class Link{ //链节点类 public int iData; public double dData; public Link next; //链表中下一个节点的引用 public Link(int iData, double dData) 阅读全文
posted @ 2016-03-30 14:13 tonglin0325 阅读(186) 评论(0) 推荐(0) 编辑
摘要:class PriorityQueue{ private int maxSize; //队列的长度 private long[] queueArray; //创建队列的数组的引用 private int curNum; //创建当前元素的个数 public PriorityQueue(int s) 阅读全文
posted @ 2016-03-29 21:22 tonglin0325 阅读(256) 评论(0) 推荐(0) 编辑
摘要:class Queue{ private int maxSize; //队列的长度 private long[] queueArray; //创建队列的数组的引用 private int front; //创建队头的引用 private int rear; //创建队尾的引用 private int 阅读全文
posted @ 2016-03-29 20:07 tonglin0325 阅读(217) 评论(0) 推荐(0) 编辑
摘要:class Stack{ private int maxSize; //栈的长度 private long[] stackArray; //创建栈的数组的引用 private int top; //创建栈顶的引用 public Stack(int s) { //构造函数 this.maxSize = 阅读全文
posted @ 2016-03-29 11:23 tonglin0325 阅读(325) 评论(0) 推荐(0) 编辑
摘要:二叉树:查找时间复杂度:最好:,最差。最差情况是所有的数据全部在一端时。 二叉搜索树(二叉排序树、二叉查找树):查找时间复杂度:最好:,最差。最差情况是所有的数据全部在一端时。 平衡二叉树:查找时间复杂度: 红黑树:查找删除插入时间复杂度: 红黑树是一种自平衡的二叉排序树,它是复杂的,但它的操作有着 阅读全文
posted @ 2016-03-02 21:54 tonglin0325 阅读(424) 评论(0) 推荐(0) 编辑

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