02 2014 档案

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 阅读(156) 评论(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)

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)

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)

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)

amazon 面经
摘要:(1)聊聊平时用到的基本数据结构,各有什么优劣,以及什么时候该用哪个数据结构;(2)聊一个自己成功的research project。着重谈谈这个project成功的几个关键步骤;(3)一个2D矩阵,每个单元都是一个字符。相邻字符可以连起来,这样就可以逐渐组成一个单词。(一个字符可以和周围8个方向的相邻字符连接)。但是在一个单词中,同一个位置只能经过一次。打印出所有合法单词,不重复。What is encapsulation?Ans) The encapsulation is achieved by combining the methods and attribute into a clas 阅读全文

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

面向对象 定义
摘要:Method overriding, in object oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes.OOPS ConceptQ1) What is polymorphism?Ans)Polymorphismgives us the ulti 阅读全文

posted @ 2014-02-18 02:12 brave_bo 阅读(208) 评论(0) 推荐(0)

LRU
摘要:import java.util.*;/* * we are using linked list with hashmap for Lru.Reason behind this is ,since HashMap is able to store data and key but * how do we get info about least recently used cache value?. For this we need to keep track all inserted data into map * by using linked list. When inserting n 阅读全文

posted @ 2014-02-17 04:55 brave_bo 阅读(185) 评论(0) 推荐(0)

quick sort
摘要:import java.util.Comparator;import java.util.PriorityQueue;public class solution2 { public static void main(String[] args) { // TODO Auto-generated method stub int A[] = {3,4,6,3,5,33,8,6,4,3,2,1,4,0,3}; quickSort(A,0,A.length-1); for(int i : A){ System.out.... 阅读全文

posted @ 2014-02-16 16:54 brave_bo 阅读(135) 评论(0) 推荐(0)

quicksort liner find kth smallest or
摘要:Let's solve a problem with application of quick sort.Problem statementGiven an set of numbers in non-sorted order, find the Kth smallest element.Kth s... 阅读全文

posted @ 2014-02-16 15:27 brave_bo 阅读(310) 评论(0) 推荐(0)

comparator for String
摘要:import java.util.Comparator;import java.util.PriorityQueue;public class solution2 { /** * @param args */ @SuppressWarnings("unchecked") PriorityQueue queue = new PriorityQueue(2,new comparatorString()); public static void main(String[] args) { // TODO Auto-... 阅读全文

posted @ 2014-02-16 11:49 brave_bo 阅读(514) 评论(0) 推荐(0)

面试步骤
摘要:热情洋溢。一边说一边写。怎么个配置,我负责什么,怎么协同工作.Could you be more specific about?this team is foucs on .... so ,what kind of technoly you often use in the team?what's the team struct in this team. how many PM and software developer. 阅读全文

posted @ 2014-02-12 01:38 brave_bo 阅读(136) 评论(0) 推荐(0)

abstract vs interface
摘要:Abstract classes can have constant, members, method and method implementations, whereas interfaces can only have may only containmethod signatureand constant declarations(both static and final)staticfinal.Methods and members of an abstract class can be defined with any visibility, whereas all method 阅读全文

posted @ 2014-02-09 05:11 brave_bo 阅读(185) 评论(0) 推荐(0)

面向对象设计 经验谈
摘要:/*面向对象设计把握一个重要的经验:谁拥有数据,谁就对外提供操作这些数据的方法 1.人在黑板上画圆 2.列车司机紧急刹车 3.售货员统计收获小票的金额 4.你把门关上了 5。球从一根绳子的一段移动到了另一端*/ 1.对于这个设计,上面有person , blackborad , circle三个对象, 动词 : 画。 因为画的动作的数据 x,y,randius 是circle拥有的数据,所以 draw()方法应该属于circle对象。。。而不是动作的发出者。。而发出者往往会委托动作承受者2。 司机发出的刹车动作会委托车本身来完成3。售货员统计小票的动作会委托小票来完成4。关门的动作会委托门.. 阅读全文

posted @ 2014-02-07 07:16 brave_bo 阅读(205) 评论(0) 推荐(0)

导航