上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页

2014年4月16日

tree 专栏

摘要: 算法演绎:http://code.jcly.twbbs.org/docs/algorithm/%E6%BC%94%E7%AE%97%E6%B3%95%E7%AD%86%E8%A8%98/www.csie.ntnu.edu.tw/_u91029/Tree.htmlTop-Down Approachan... 阅读全文

posted @ 2014-04-16 03:14 brave_bo 阅读(133) 评论(0) 推荐(0)

2014年4月8日

Linked List 专栏

摘要: 问题一: merge two sorted linkedlist.Key to solve this problemThe key to solve the problem is defining a fake head. Then compare the first elements from each list. Add the smaller one to the merged list. Finally, when one of them is empty, simply append it to the merged list, since it is already sorted. 阅读全文

posted @ 2014-04-08 04:16 brave_bo 阅读(170) 评论(0) 推荐(0)

2014年3月29日

Deadlock Livelock thread starvation

摘要: public class Deadlock { public static void main(String[ ] args) { // These are the two resource objects we'll try to get locks for final Object resource1 = "resource1"; final Object resource2 = "resource2"; int a=0; // Here's the first thread. It tries to lock... 阅读全文

posted @ 2014-03-29 02:11 brave_bo 阅读(340) 评论(0) 推荐(0)

2014年2月27日

different between c++ and java

摘要: Java doesnot support pointers. Pointers are tricky to use and troublesome.Java does not support multiple inheritances because it causes more problems than it solves. Instead Java supports multiple interface inheritance, which allows an object to inherit many method signatures from different interfac 阅读全文

posted @ 2014-02-27 05:23 brave_bo 阅读(157) 评论(0) 推荐(0)

parking lot

摘要: We follow the four steps in the design principle:FUNCTIONThere are three types of parking spaces: motorbike, car and handicapped car. Motorbikes and cars can only be parked in their designated parking spaces, while handicapped cars can be parked either in their own parks or those for regular cars.An 阅读全文

posted @ 2014-02-27 04:19 brave_bo 阅读(499) 评论(0) 推荐(0)

2014年2月25日

tree 中 最可能大的路径

摘要: public class Solution1 { int sum = 0; public int hightvalue(Node root){ if(root == null) return 0; if(root.left == null && root.right == null) return 1; int left = hightvalue(root.left); int right = hightvalue(root.right); sum = sum ... 阅读全文

posted @ 2014-02-25 11:29 brave_bo 阅读(233) 评论(0) 推荐(0)

2014年2月24日

hashmap or array

摘要: Maintaining order:- A list by definition is ordered. You add items and then you are able to iterate back through the list in the order that you insert... 阅读全文

posted @ 2014-02-24 09:34 brave_bo 阅读(202) 评论(0) 推荐(0)

bit map

摘要: 、bit-map 适用范围:可进行数据的快速查找,判重,删除,一般来说数据范围是int的10倍以下 基本原理及要点:使用bit数组来表示某些元素是否存在,比如8位电话号码 扩展:bloom filter可以看做是对bit-map的扩展 问题实例: 1)已知某个文件内包含一些电话号码,每个号码为8位数字,统计不同号码的个数。 8位最多99 999 999,大概需要99m个bit,大概10几m字节的内存即可。 2)2.5亿个整数中找出不重复的整数的个数,内存空间不足以容纳这2.5亿个整数。 将bit-map扩展一下,用2bit表示一个数即可,0表示未出现,1表示出现一次,2表示出现... 阅读全文

posted @ 2014-02-24 09:00 brave_bo 阅读(377) 评论(0) 推荐(0)

大数据问题

摘要: 第一部分、十道海量数据处理面试题1、海量日志数据,提取出某日访问百度次数最多的那个IP。 首先是这一天,并且是访问百度的日志中的IP取出来,逐个写入到一个大文件中。注意到IP是32位的,最多有个2^32个IP。同样可以采用映射的方法,比如模1000,把整个大文件映射为1000个小文件,再找出每个小文中出现频率最大的IP(可以采用hash_map进行频率统计,然后再找出频率最大的几个)及相应的频率。然后再在这1000个最大的IP中,找出那个频率最大的IP,即为所求。或者如下阐述(雪域之鹰):算法思想:分而治之+Hash1.IP地址最多有2^32=4G种取值情况,所以不能完全加载到内存中处理;2. 阅读全文

posted @ 2014-02-24 08:57 brave_bo 阅读(229) 评论(0) 推荐(0)

2014年2月19日

word search 此题若会,所有dfs矩阵全会

摘要: [LeetCode] Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once.For ex 阅读全文

posted @ 2014-02-19 15:25 brave_bo 阅读(374) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页

导航