- 博客(5)
- 收藏
- 关注
原创 二叉排序树
问题记录若二叉排序树中有值相同的节点,将会在search()和searchParent()两个函数中陷入死循环,出现栈溢出异常StackOverflowError,已有解决思路,后期优化!完整代码public class BinarySortTreeDemo { public static void main(String[] args) { int[] arr = {7, 3, 10, 12, 5, 1, 9, 2, 10}; BinarySortTree
2022-01-26 22:26:52
878
原创 赫夫曼编码与解码
节点类class Node implements Comparable<Node> { Byte data; int weight; Node left; Node right; public Node(Byte data, int weight) { this.data = data; this.weight = weight; } @Override public String toStr
2022-01-23 15:38:18
441
原创 堆排序(大顶堆,升序)
public class HeapSort { public static void main(String[] args) { int arr[] = {4, 6, 8, 5, 9}; heapSort(arr); System.out.println(Arrays.toString(arr)); // 排序后4, 5, 6, 8, 9 } /** * 1、将无序序列构建成一个堆,根据升序降序需求选择大顶堆或小顶堆
2022-01-17 22:20:25
709
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人