上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 57 下一页
摘要: /** * @desc: 自定义堆排序:从小到大排序 * @author: 毛会懂 * @create: 2021-01-06 14:50:00 **/ public class MyHeapSort<T> { public static void sort(Comparable[] source) 阅读全文
posted @ 2021-01-07 11:54 毛会懂 阅读(391) 评论(0) 推荐(0) 编辑
摘要: /** * @desc: 自定义堆结构:构造大顶堆,实现插入和删除操作 * @author: 毛会懂 * @create: 2021-01-06 10:35:00 **/ public class MyHeap<T extends Comparable<T>>{ private T[] arr; p 阅读全文
posted @ 2021-01-07 11:51 毛会懂 阅读(155) 评论(0) 推荐(0) 编辑
摘要: /** * @desc: 自定义二叉查找树: 插入键值对,根据key查找元素值,删除节点,取最大(小)的元素值, * 前序(中序,后序,层次)遍历,树的高度 * @author: 毛会懂 * @create: 2021-01-05 14:11:00 **/ public class MyBinary 阅读全文
posted @ 2021-01-07 11:44 毛会懂 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 来源: https://blog.csdn.net/qq_41587740/article/details/104215365 二叉树的存储结构 双亲表示法: 孩子表示法: 孩子兄弟表示法: 三种存储结构的对比: 双亲表示法: 原理: R为头节点,所以parent=-1; ABC的双亲节点数组下标为 阅读全文
posted @ 2020-12-31 14:52 毛会懂 阅读(227) 评论(0) 推荐(0) 编辑
摘要: //循环列表场景:传说有这样一个故事,在罗马人占领乔塔帕特后,39 个犹太人与约瑟夫及他的朋友躲到一个洞中,39个犹太人决 //定宁愿死也不要被敌人抓到,于是决定了一个自杀方式,41个人排成一个圆圈,第一个人从1开始报数,依次往 //后,如果有人报数到3,那么这个人就必须自杀,然后再由他的下一个人重 阅读全文
posted @ 2020-12-31 14:06 毛会懂 阅读(151) 评论(0) 推荐(0) 编辑
摘要: //单链表的使用:快慢指针,如何判断是否有环,环在哪个节点 public static void main(String[] args) { Node<Integer> node1 = new Node(1,null); Node<Integer> node2 = new Node(2,null); 阅读全文
posted @ 2020-12-31 14:04 毛会懂 阅读(108) 评论(0) 推荐(0) 编辑
摘要: //单链表的使用:快慢指针,如何找中间值 public static void main(String[] args) { Node<Integer> node1 = new Node(1,null); Node<Integer> node2 = new Node(2,null); Node<Int 阅读全文
posted @ 2020-12-31 14:03 毛会懂 阅读(163) 评论(0) 推荐(0) 编辑
摘要: /** * @desc: 基于单链表实现有序Map * 有序Map,主要是在插入元素时,保证队列有序即可,所以key需要实现Comparable接口。 * @author: 毛会懂 * @create: 2020-12-30 13:31:00 **/ public class MyOrderMap< 阅读全文
posted @ 2020-12-31 13:51 毛会懂 阅读(158) 评论(0) 推荐(0) 编辑
摘要: ** * @desc: 基于单链表实现Map结构 * 实现Iterable接口,方便遍历Map * @author: 毛会懂 * @create: 2020-12-30 13:31:00 **/ public class MyMap<K,V> implements Iterable<K>{ priv 阅读全文
posted @ 2020-12-31 13:49 毛会懂 阅读(148) 评论(0) 推荐(0) 编辑
摘要: /** * @desc: 队列--单链表实现 * @author: 毛会懂 * @create: 2020-12-30 10:55:00 **/ public class MyQueue<T> implements Iterable<T>{ private Node head; private No 阅读全文
posted @ 2020-12-31 13:44 毛会懂 阅读(87) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 57 下一页