摘要: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...
阅读全文
摘要:(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...
阅读全文
摘要:array can do something right . shifting ...not good.linkedlist good in shifting but access not good.
阅读全文
摘要: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<...
阅读全文
摘要:rebalance a heapheap is a complete binary tree.⑴最大堆的插入 由于需要维持完全二叉树的形态,需要先将要插入的结点x放在最底层的最右边,插入后满 足完全二叉树的特点; 然后把x依次向上调整到合适位置满足堆的性质,例如下图中插入80,先将80放在最后,然后...
阅读全文
摘要:1 public class ChessPieceTurn { };2 public class GameManager {3 void processTurn(PlayerBase player) { };4 boolean acceptTurn(ChessPieceTurn turn) { re...
阅读全文
摘要:class Edge { enum Type { inner, outer, flat } Piece parent; Type type; boolean fitsWith(Edge type) { }; // Inners & outer f...
阅读全文
摘要: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...
阅读全文
摘要:package card;public class Game implements Runnable{ int numPlayers; int startNumber; //players and hands seperate so players can't change the...
阅读全文
摘要:card.oop. #字大数据 bst, kth......
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:http://www.geeksforgeeks.org/amazon-interview-set-107/F2F-I:1) Brief discussion on work in current company2) Flatten linked list – http://www.geeksfor...
阅读全文
摘要: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...
阅读全文
摘要:1st round: 一个白人,先是聊了下project,然后一道coding题,找到距离一个节点k的所有节点。这个直接node bfs就可以解决。这一轮很基础。node bfs 加 count 计算level就行. facebook电面原题2nd round: 一个印度小伙,上来就是题,没有beh...
阅读全文
摘要:public void quicksort(int[] array, int low, int high){ int i = low; int j = high; if(i>j) return; int pivot = i...
阅读全文
摘要:public abstract class Vehicle { protected ParkingSpace pSpace; public abstract boolean park(ParkingLot pLot); public boolean unpark(ParkingLot p...
阅读全文
摘要: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...
阅读全文