08 2014 档案

hash function 3种方法 1不好 2一般 3好
摘要:1. h(k) = k mod m its is really bad in thepractical. if m = even and k is all even....( m is size of hash table, modulo['mɔdjuləu)2. multiplication m... 阅读全文

posted @ 2014-08-28 06:30 brave_bo 阅读(278) 评论(0) 推荐(0)

radix sort
摘要:(radix sort)Problem StatementGiven an integer array of length N, containing values in the range 1,2,3…N^2. Sort the array in O(N) time.//http://www.ge... 阅读全文

posted @ 2014-08-28 04:15 brave_bo 阅读(152) 评论(0) 推荐(0)

array linkedlist in divide and ..
摘要:array can do something right . shifting ...not good.linkedlist good in shifting but access not good. 阅读全文

posted @ 2014-08-28 03:12 brave_bo 阅读(117) 评论(0) 推荐(0)

Fibonacci 引出的关于递归时间复杂度
摘要:FinonacciT(N) = T(N-1) + T(N-2);>= 2T(N-2) = O(2^(N/2))Memorized Dp algorithm//1,1,2,3,5,8.....Memo = {}fib(n): if n in memo, return memo{n} if n<... 阅读全文

posted @ 2014-08-28 03:11 brave_bo 阅读(389) 评论(0) 推荐(0)

rebalance
摘要:rebalance a heapheap is a complete binary tree.⑴最大堆的插入 由于需要维持完全二叉树的形态,需要先将要插入的结点x放在最底层的最右边,插入后满 足完全二叉树的特点; 然后把x依次向上调整到合适位置满足堆的性质,例如下图中插入80,先将80放在最后,然后... 阅读全文

posted @ 2014-08-25 14:29 brave_bo 阅读(359) 评论(0) 推荐(0)

amazon 设计 11 chess
摘要:1 public class ChessPieceTurn { };2 public class GameManager {3 void processTurn(PlayerBase player) { };4 boolean acceptTurn(ChessPieceTurn turn) { re... 阅读全文

posted @ 2014-08-14 06:39 brave_bo 阅读(242) 评论(0) 推荐(0)

amazon 设计 10 puzzle.
摘要:class Edge { enum Type { inner, outer, flat } Piece parent; Type type; boolean fitsWith(Edge type) { }; // Inners & outer f... 阅读全文

posted @ 2014-08-12 05:36 brave_bo 阅读(181) 评论(0) 推荐(0)

amazon 设计 9 chat server
摘要:Solution:Apparently, I am too naive and I think too few. Here's the detailed solution.What is our chat server?This is something you should discuss wit... 阅读全文

posted @ 2014-08-12 03:47 brave_bo 阅读(187) 评论(0) 推荐(0)

amazon 设计 7 genial card game
摘要:package card;public class Game implements Runnable{ int numPlayers; int startNumber; //players and hands seperate so players can't change the... 阅读全文

posted @ 2014-08-12 02:52 brave_bo 阅读(302) 评论(0) 推荐(0)

amazon 疑点
摘要:card.oop. #字大数据 bst, kth...... 阅读全文

posted @ 2014-08-11 12:07 brave_bo 阅读(137) 评论(0) 推荐(0)

amazon 面经 5
摘要:http://www.geeksforgeeks.org/amazon-interview-set-105-campus/First PI:1. A brief discussion on my projects that I have done .2. One thing that I am mo... 阅读全文

posted @ 2014-08-10 14:51 brave_bo 阅读(382) 评论(0) 推荐(0)

amazon 面经4
摘要:Round 1(Bar Raiser):Complete discussion on my project.Suppose you have a file with billion entries and you have to sort the data of a file according t... 阅读全文

posted @ 2014-08-10 07:55 brave_bo 阅读(176) 评论(0) 推荐(0)

amazon 面经3
摘要:http://www.geeksforgeeks.org/amazon-interview-set-107/F2F-I:1) Brief discussion on work in current company2) Flatten linked list – http://www.geeksfor... 阅读全文

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

amazon 面经2
摘要:http://www.geeksforgeeks.org/amazon-interview-set-108-campus/F2F-1:1) Given a sorted circular link list and a pointer to random node, now insert a new... 阅读全文

posted @ 2014-08-08 02:50 brave_bo 阅读(307) 评论(0) 推荐(0)

amazon 面经1
摘要:1st round: 一个白人,先是聊了下project,然后一道coding题,找到距离一个节点k的所有节点。这个直接node bfs就可以解决。这一轮很基础。node bfs 加 count 计算level就行. facebook电面原题2nd round: 一个印度小伙,上来就是题,没有beh... 阅读全文

posted @ 2014-08-07 04:37 brave_bo 阅读(699) 评论(0) 推荐(0)

quicksort
摘要:public void quicksort(int[] array, int low, int high){ int i = low; int j = high; if(i>j) return; int pivot = i... 阅读全文

posted @ 2014-08-04 07:05 brave_bo 阅读(147) 评论(0) 推荐(0)

amazon 设计 6 parking lot
摘要:public abstract class Vehicle { protected ParkingSpace pSpace; public abstract boolean park(ParkingLot pLot); public boolean unpark(ParkingLot p... 阅读全文

posted @ 2014-08-04 05:21 brave_bo 阅读(1015) 评论(0) 推荐(0)

why using List list = new ArrayList() better than Arraylist list?
摘要:This is called programming to interface. This will be helpful in case if you wish to move to some other implementation of List in the future. If you w... 阅读全文

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

导航