随笔分类 -  Data Structure

摘要:二叉树遍历 遍历命名 根据访问结点操作发生位置命名: ① NLR:前序遍历(Preorder Traversal 亦称(先序遍历)) ——访问根结点的操作发生在遍历其左右子树之前。 ② LNR:中序遍历(Inorder Traversal) ——访问根结点的操作发生在遍历其左右子树之中(间)。 ③ 阅读全文
posted @ 2019-07-06 20:03 喝花茶 阅读(379) 评论(0) 推荐(0)
摘要:稀疏数组,作为压缩普通数组的一种方式 import java.util.Arrays; /** * 1、原数组的行数,列数,非0数据个个数 * 2、所有非0数据个坐标(row,column) */ public class SparseArray { public static int[][] toSparseArray(int[][] array) { /... 阅读全文
posted @ 2019-07-05 21:07 喝花茶 阅读(779) 评论(0) 推荐(0)
摘要:Queue定义,直接copyJava的Queue,去除了Collection接口。 ArrayQueue 阅读全文
posted @ 2019-07-05 20:33 喝花茶 阅读(2713) 评论(0) 推荐(0)