随笔分类 - 算法数据结构
摘要:题目解读 1. 文件格式:访问时间,来源IP,响应结果,响应耗时 2. 文件大小:超大规模,TB数量级 解题思路 首先,数据量过大,通过内存计算肯定是不可行的。 考虑采用分治,将大文件切割成小文件,再对小文件分析,找出访问次数最多的,此时将问题转化为:切割小文件算法 具体思路如下: 将1T的文件按照
阅读全文
摘要:关于堆的介绍和操作可以参考:https://www.jianshu.com/p/6b526aa481b1 上面这篇文章写得非常详细。 堆的操作主要有:插入元素、删除堆顶元素两个操作。 以下代码都以小根堆为例。 插入元素代码: 删除堆顶元素代码: 测试代码(创建堆、删除堆顶元素): 输出结果:
阅读全文
摘要:题干: Given a string, find the length of the longest substring without repeating characters. 给定一个字符串,求他的最长子串。 Example 1: Input: "abcabcbb" Output: 3 Exp
阅读全文
摘要:题干: Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a w
阅读全文
摘要:这个问题太简单了,直接上代码
阅读全文
摘要:题干: Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could
阅读全文

浙公网安备 33010602011771号