上一页 1 2 3 4 5 6 7 8 9 ··· 16 下一页

2014年10月1日

Tree 总结

摘要: http://leetcode.com/2011/07/lowest-common-ancestor-of-a-binary-tree-part-i.html两种思路:top-down bottom-up递归实现,递归里面可以添加小递归方法. n^2自己总结的万能思路首先1. top-down 还... 阅读全文

posted @ 2014-10-01 05:54 brave_bo 阅读(124) 评论(0) 推荐(0)

2014年8月28日

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

2014年8月25日

rebalance

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

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

2014年8月14日

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)

2014年8月12日

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 阅读(176) 评论(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 阅读(185) 评论(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 阅读(296) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 16 下一页

导航