二叉堆

摘要: 堆 如何手写一个堆? 首先堆是一颗完全二叉树,结合完全二叉树的性质我们可以利用数组来存储一棵树。每个结点的编号从1开始。 插入一个数。 heap[++size] = x; up(size); 求集合当中的最小值。heap[1] 删除最小值。 heap[1] = heap[size]; size--; 阅读全文
posted @ 2021-02-06 14:36 翔鸽 阅读(52) 评论(0) 推荐(0)

1107 Social Clusters——PAT甲级真题

摘要: 1107 Social Clusters When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the 阅读全文
posted @ 2021-02-06 09:28 翔鸽 阅读(98) 评论(0) 推荐(0)