随笔分类 -  构造类

摘要:Heap的介绍1,介绍2,要注意complete tree和full tree的区别, Heap是complete tree;Heap里面 i 的 children分别是 i*2+1 和 i*2+2,i 的 parent是 (i-1)/2 Heapify的基本思路就是:Given an array 阅读全文
posted @ 2017-11-08 01:26 apanda009 阅读(360) 评论(0) 推荐(0)
摘要:0. Trie数据结构,也就是前缀树。然后dfs时,如果当前形成的单词不在Trie里,就没必要继续dfs下去了。如果当前字符串在trie里,就说明board可以形成这个word。 这道题很好的体现了Trie的优势:不用Trie, 我们就得把String[] words里面的word一个一个去boar 阅读全文
posted @ 2017-07-28 12:10 apanda009 阅读(185) 评论(0) 推荐(0)
摘要:键值对想到hashmap, 增删节点考虑链表, + 头尾节点, 因此要构造相应的类 双向链表需要头尾节点 The problem can be solved with a hashtable that keeps track of the keys and its values in the dou 阅读全文
posted @ 2017-07-26 21:44 apanda009 阅读(181) 评论(0) 推荐(0)
摘要:Given a nested list of integers represented as a string, implement a parser to deserialize it. Each element is either an integer, or a list -- whose e 阅读全文
posted @ 2017-07-06 17:07 apanda009 阅读(151) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/EdwardLiu/p/6139796.html https://leetcode.com/problems/find-right-interval/#/solutions Solution 1: TreeMap, Time complexity: O( 阅读全文
posted @ 2017-06-22 21:57 apanda009 阅读(190) 评论(0) 推荐(0)