Giter Club home page Giter Club logo

play-data-structure-by-java's Introduction

各种数据结构的java实现

02-数组

动态数组,底层使用了Java的数组,支持泛型  

03-栈与队列

(实现DFS与BFS的辅助数据结构),以02中的数组作为底层结构,同时实现了循环队列  

04-链表

链表的增删改查,附有链表18个经典问题,以链表为底层结构实现的队列与栈  

05-递归

NULL  

06-二叉搜索树

增查改都很容易,删除稍难一些,二叉树具有天然的递归性质,实现中也使用了很多递归写法  

07-集合与映射

以06二叉搜索树为底层结构实现的集合,映射
以04链表为底层结构实现的集合,映射  

08-堆和优先队列

以02数组为底层结构实现了最大堆,可解决前K个最*元素问题。  
以堆为底层结构实现了优先队列。如果将队列的性质进一步推广,栈也算得上一种队列  
关于重写Java比较器的匿名函数、lambda表达式等写法  

09-线段树

实质:基于区间的统计查询
使用数组作为底层结构,空间为原数组的4倍(最差情况)-->满二叉树,与堆相似  
使用Merger接口实现了线段树中父节点的取值方式(lambda表达式)  

09-2 跳表

只靠节点,没用数组
实现了增、删、查三个功能
测试通过了Leetcode的跳表设计问题
部分使用了递归,整体逻辑还是比较清楚的

10-前缀树

Trie,通讯录,单词表等常用数据结构,实现了增查,没实现删除操作

11-并查集

支持合并与是否连接操作,由孩子节点指向父亲节点的结构
实现了基于size,rank,两种路径压缩的优化思路

12-AVL树

第一种自平衡树,通过平衡因子判断是否平衡,通过左旋转右旋转维护平衡

13-大名鼎鼎的红黑树

14-哈希表

实现了简单的链地址法以解决哈希冲突
使用TreeMap作为底层数据,实现了哈希表常规操作增删查改

15-图

无向无权图以及相关算法(哈密尔顿路径、二分图、环、桥、割点等)
无向有权图以及相关算法(dijkstra,Bellman-Ford,Floyd算法)
有向图以及相关算法

play-data-structure-by-java's People

Contributors

wantime avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.