Showing posts with label Majority. Show all posts
Showing posts with label Majority. Show all posts

Decimal dominants


https://www.cnblogs.com/evasean/p/7273857.html
Decimal dominants. Given an array with n keys, design an algorithm to find all values that occur more than  n/10 times. The expected running time of your algorithm should be linear.
分析:
直观上将n个元素遍历一遍,并记录每个元素出现的次数就可以实现,虽然时间复杂度是O(n),但是空间复杂度却高达n,这肯定不是该题目的初衷。对于n个元素来说,出现n/10次的元素最多有10个,那么出现超过n/10次的元素最多不超过9个,所以需要9个额外空间auxs就能满足需求。
这9个辅助空间aux怎么使用呢?可采用俄罗斯方块的消去一行的思路。只不过这里消去一行的情况是该行中元素各不相同。
1. 遍历数组array中的每个元素array[i]
2. 如果array[i]在aux中存在,将其在aux中的计数+1
3. 如果array[i]在aux中不存在
  3.1 如果aux未满,将其放入aux中,并记录其个数为1
  3.2 如果aux已满,将aux中已经存在的各个元素的计数都减去1,直到某个元素的个数变成0,将array[i]放入aux中该位置处,并记录其个数为1
4. 出现次数超过n/10的元素在array遍历完了之后,还会继续存在于aux中,当然aux中可存在着位于array后方但出现次数不满足要求的元素。这时只需要遍历aux的同时再遍历一遍array,记录aux中各个元素在array中出现的次数,将其中出现次数真正超过n/10的元素找出来即可。
Naively, we could just count the number of occurrences of each elements.
  • define a hash map from the values to the number of occurrence of those values in the array.
  • iterate through the array and populate the hash map.
  • iterate through the hash map and get keys with values greater than or equal to n/10.
This takes ~N time and ~N space.
Solution 2
We can optimize the first solution to reduce the memory usage. The key point leading to this optimization is that if the array is of size n, there can be at most 9 elements that occur more than n/10 times. If we suppose that the array had 10 elements that occur more than n/10 times, then we will have more than n elements in the array, which is a contradiction.
With this realization in mind, we can solve the problem using 9 buckets with Boyer-Moore majority vote algorithm.
Basically, we can remember 9 elements along with the number of times they have been seen so far in a loop. When a remembered element is seen, its count is incremented. If an element which is not remembered is seen, we fit it into a slot if one is free. If no slot is free, subtract 1 from all counts. If the count is 0, forget the element.
This takes ~N time and ~1 space.
Solution 3
We can also use a selection algorithm to solve the problem in a linear time. If we imagine the array was sorted in a descending order, we can narrow our candidates to 9 elements, namely (n/10)-th, (2n/10)-th, … (9n/10)-th elements.
In this imaginary sorted version of the array, any elements left to (n/10)-th array cannot occur more than n/10 times because there won’t be enough room.
Using QuickSelect, we can get (n/10)-th largest element from the array without sorting the entire array. After checking if (n/10)-th largest element is decimal dominant, we apply the same procedure to the array including and to the right side of (n/10)-th largest element. This means we check for (2n/10)-th largest element, and so on.
This takes ~N time (9 calls to QuickSelect) and ~1 space.

https://raw.githubusercontent.com/phareskrad/algs4/master/jobinterviewquestions/QuickSort.java
        public DecimalDominants(int[] a, int k) {
            A = a;
            N = a.length;
            K = k;

            buildCounts(a);
        }

        private void buildCounts(int[] a) {
            for (int i = 0; i < N; i++) {
                if (counts.containsKey(i)) counts.put(i, counts.get(i) + 1);
                else counts.put(i, 1);
                if (counts.keySet().size() >= K) removeCounts();
            }
        }

        private void removeCounts() {
            for (int k : counts.keySet()) {
                int c = counts.get(k);
                if (c > 1) counts.put(k, c - 1);
                else counts.remove(k);
            }
        }

        public Iterable<Integer> find() { //brute force
            Bag<Integer> result = new Bag<Integer>();
            for (int k : counts.keySet()) {
                if (count(k) > N/K) result.add(k);
            }
            return result;
        }

        private int count(int k) {
            int count = 0;
            for (int i = 0; i < N; i++) {
                if (A[i] == k) count++;
            }
            return count;
        }
    }



 7 public class ElemsMoreThanNDivTenTimes {
 8     
 9     private class Element{//辅助空间元素定义,用来记录元素值及其出现次数
10         public int element;
11         public int count;
12         public Element(int e,int c){
13             this.element = e;
14             this.count = c;
15         }
16     };
17     private Element[] elems = new Element[9]; //申请9个辅助空间
18     
19     
20     public ArrayList<Integer> findElements(int[] arrays){
21         int n = arrays.length;
22         for(int k=0;k<9;k++){
23             elems[k] = new Element(0,0); //辅助空间初始化
24         }
25         for(int i=0;i<n;i++){
26             int index = findIndex(arrays[i]);
27             if(index >= 0)
28                 elems[index].count ++;
29             else
30                 addToElems(arrays[i]);
31         }
32         return verifyElems(arrays);
33     }
34     
35     private int findIndex(int e){
36         for(int k = 0; k<9;k++){
37             if(elems[k].element == e)
38                 return k;
39             else if(elems[k].count == 0){
40                 elems[k].element = e;
41                 return k;
42             }
43         }
44         return -1;
45     }
46     private void addToElems(int e){
47         boolean insertFlag = false;
48         while(!insertFlag){
49             for(int k=0; k<9;k++){
50                 elems[k].count --;
51                 if(elems[k].count <= 0){
52                     elems[k].element = e;
53                     elems[k].count = 1;
54                     insertFlag = true;
55                     break;
56                 }
57             }
58         }
59     }
60     private ArrayList<Integer> verifyElems(int[] arrays){
61         int n = arrays.length;
62         for(int k = 0; k< 9; k++){
63             elems[k].count = 0;
64             for(int i = 0; i< n;i++){
65                 if(arrays[i]==elems[k].element)
66                     elems[k].count++;
67             }
68         }
69         ArrayList<Integer> elemList = new ArrayList<Integer>();
70         for(int k = 0; k< 9; k++){
71             if(elems[k].count > n/10)
72                 elemList.add(elems[k].element);
73         }
74         return elemList;
75     }



LeetCode 997 - Find the Town Judge


https://leetcode.com/problems/find-the-town-judge/
In a town, there are N people labelled from 1 to N.  There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
  1. The town judge trusts nobody.
  2. Everybody (except for the town judge) trusts the town judge.
  3. There is exactly one person that satisfies properties 1 and 2.
You are given trust, an array of pairs trust[i] = [a, b] representing that the person labelled a trusts the person labelled b.
If the town judge exists and can be identified, return the label of the town judge.  Otherwise, return -1.

Example 1:
Input: N = 2, trust = [[1,2]]
Output: 2
Example 2:
Input: N = 3, trust = [[1,3],[2,3]]
Output: 3
Example 3:
Input: N = 3, trust = [[1,3],[2,3],[3,1]]
Output: -1
Example 4:
Input: N = 3, trust = [[1,2],[2,3]]
Output: -1
Example 5:
Input: N = 4, trust = [[1,3],[1,4],[2,3],[2,4],[4,3]]
Output: 3

Note:
  1. 1 <= N <= 1000
  2. trust.length <= 10000
  3. trust[i] are all different
  4. trust[i][0] != trust[i][1]
  5. 1 <= trust[i][0], trust[i][1] <= N

X. Graph
https://blog.csdn.net/fuxuemingzhu/article/details/87903828
其实这个就是有向图,[a, b]表示从顶点a出发指向顶点b的一条有向边。

所以,题目的意思就是:是否存在且只存在一个顶点,所有的顶点都指向他,但是这个点不指向任何点。用术语来说就是该顶点的入度是N - 1,出度是0.

我们可以使用一个数组存储每个点的入度和出度的差,当某个点的入度和出度的差是N - 1时,代表他是法官,否则不存在。

证明:如果入度和出度的差 = N - 1,又入度、出度 >= 0,那么入度 = N- 1,出度 = 0,满足条件1和2.一旦存在一个点满足条件,那么说明这个点没有出度,所以不存在另一个点的入度是N - 1,满足条件3
https://leetcode.com/problems/find-the-town-judge/discuss/242938/JavaC%2B%2BPython-Directed-Graph
Consider trust as a graph, all pairs are directed edge.
The point with in-degree - out-degree = N - 1 become the judge.
Explanation:
Count the degree, and check at the end.
Time Complexity:
Time O(T + N), space O(N)
Since town judge trusts nobody, can we say thatthe point who has no out-degree and in-degree == N - 1 is the judge?


    public int findJudge(int N, int[][] trust) {
        int[] count = new int[N+1];
        for (int[] t: trust) {
            count[t[0]]--;
            count[t[1]]++;
        }
        for (int i = 1; i <= N; ++i) {
            if (count[i] == N - 1) return i;
        }
        return -1;
    }
https://leetcode.com/problems/find-the-town-judge/discuss/244198/Java-Straight-forward-solution
I used two integer arrays to represent who people trust and who were trusted.
After storing all values into the two arrays just go through those two arrays and find the person with 0 trust person and being trusted by N - 1 people.
Time Complexity: O(N).
public int findJudge(int N, int[][] arr) {
        int[] trust = new int[N];
        int[] trusted = new int[N];
        for(int i = 0; i < arr.length; i++){
            int a = arr[i][0]; 
            int b = arr[i][1];
            trust[a - 1]++;
            trusted[b - 1]++;
        }
        for(int i = 0; i < N; i++){
            if(trust[i] == 0 && trusted[i] == N - 1)
                return i + 1;
        }
        return -1;
    }
X. https://leetcode.com/problems/find-the-town-judge/discuss/242952/C%2B%2B-4-lines-%22Find-the-Celebrity%22
If we are given trust connections as an adjacency matrix (or a hash map), we can use the same algorithm as in the Find the Celebrity problem. Here is solution and explanationsto that problem. This cool technique to quickly find a potential celebrity helps reduce the runtime and memory complexity.
int findJudge(int N, vector<vector<int>>& trust) {
  vector<vector<int>> knows(N + 1, vector<int>(N + 1));
  for (auto &t : trust) knows[t[0]][t[1]] = 1;
  return findCelebrity(N, knows);
}
int findCelebrity(int n, vector<vector<int>>& knows, int i = 1) {
  for (auto j = i + 1; j <= n; ++j) if (knows[i][j]) i = j;
  for (auto j = 1; j < i; ++j) if (knows[i][j]) return -1;
  for (auto j = 1; j <= n; ++j) if (i != j && !knows[j][i]) return -1;
  return i;
}

Complexity Analysis

Note that we analyze the complexity of findCelebrity (without preparation steps).
Time: O(N).
Memory: O(1).


Popular Numbers in Sorted Array- 4/n


http://www.1point3acres.com/bbs/thread-147482-1-1.html
找一个sorted array里面出现次数多于N/4的元素
就是0 ,n/4, 2n/4, 3n/4, n。 然后分别左右搜索
        public static boolean ifExistMoreThanQuarter(int[] sorted){
                if(sorted == null || sorted.length == 0){
                        return false;
                }. 鍥磋鎴戜滑@1point 3 acres
                else if(sorted.length < 4){
                        return true;. 1point3acres.com/bbs
                }
                int mid = sorted.length / 2;
                int target = sorted[mid];
                int l = binarySearch(sorted, 0, mid, target, true);
                int r = binarySearch(sorted, mid, sorted.length - 1, target, false); // no need, just need check sorted[l+n/4]==target
                if(r - l + 1 > sorted.length / 4){
                        return true;
                }
                int leftQuarter = sorted.length / 4;
                target = sorted[leftQuarter];
                l = binarySearch(sorted, 0, leftQuarter, target, true);
                r = binarySearch(sorted, leftQuarter, mid, target, false);
                if(r - l + 1 > sorted.length / 4){
                        return true;
                }
                int rightQuarter = sorted.length * 3 / 4;
                target = sorted[rightQuarter];
                l = binarySearch(sorted, mid, rightQuarter, target, true);
                r = binarySearch(sorted, rightQuarter, sorted.length - 1, target, false);
                if(r - l + 1 > sorted.length / 4){
                        return true;
                }
                return false;
        }
       
        private static int binarySearch(int[] sorted, int left, int right, int target, boolean ifLeftSide){
                while(left < right){
                        int mid = ifLeftSide? left + (right - left) / 2 : left + (right - left + 1) / 2;
                        if(ifLeftSide){
                                if(sorted[mid] < target){. from: 1point3acres.com/bbs
                                        left = mid + 1;
                                }
                                else{
                                        right = mid;
                                }
                        }
                        else{
                                if(sorted[mid] > target){
                                        right = mid - 1;
                                }
                                else{
                                        left = mid;
                                }
                        }
                }
                return left;
        }

Puzzles, Maths and Algorithms: Innocents and Criminals: Finding Minority Entity


Puzzles, Maths and Algorithms: Innocents and Criminals: Finding Minority Entity
Problem: There are two types of people in a particular city, innocents and criminals. All you know is that innocents are in majority and would like to get rid of criminals and criminals would like to protect themselves from persecution. You can ask any number of questions, with yes/no type answer, from any person in the city. Propose an algorithm which requires asking the minimum number of questions.
The trivial solution is very simple and is in-fact O(n^2) time algorithm. Round up every person and ask him about the status of everyone else. People with majority vote of criminal are criminals and people with minority vote of criminal are innocents. Following code solves it:
for i = 1 to N
   for j = 1 to N
      if person[i].isCriminal(j)  // doesnt matter if i == j
         vote[j] += 1
      else
         vote[j] -= 1

for j <- 1 to n 
   if vote[j] > 0
      person[j].persecute()

The most efficient algorithm requires asking only 2N-2 questions. The key to solution of this problem lies in the solution to the problem of Finding Majority Element. If we can find one innocent person in the city, then he can label everyone else truthfully. We know for sure that an innocent will tell the truth. Criminals can lie or say truth depending on circumstances.

Assume that we formulate the problem this way. Let us consider a pool of people, who claim to be innocents. Also let us say that we declare that we will pick the first person in the pool to be our innocent man and he will reveal the identity of everyone else. Then definitely both innocents and criminals would try their best to capture the first spot in the pool.

Now, we play a game like this. We choose a person randomly to represent the first person in the pool. Now we select a new person randomly and ask him should the last person inducted in the pool is Innocent. If he says Yes, then we add him to the pool. If he says No then we remove him and the last person from the pool and discard them from further selection. If the pool is empty we select a person not selected previously to get the first spot in the pool.

We repeat the process until we don't have anymore people to consider. The intuition is that even if all Criminals join the pool initially (by lying), then innocents would boot them out as they are in majority. If more innocents join the pool initially then criminals will not be able to boot all innocents out. Hence the first person remaining in the pool is indeed an innocent. We can see this argument working inductively as well.

The following code implements above logic with the help of a stack:
stack.push(person[1])
for i <- 2 to N
   if !stack.isEmpty() && person[i].isCriminal(stack.top())
      stack.pop()
   else
      stack.push(person[i])
return stack.bottom()
Read full article from Puzzles, Maths and Algorithms: Innocents and Criminals: Finding Minority Entity

Puzzles, Maths and Algorithms: Finding Majority Element


Puzzles, Maths and Algorithms: Finding Majority Element
Problem 1: Assume that an integer array A[1..n] has a majority element and elements other than majority element are distinct. How to find majority element. What's the space and time complexity of the algorithm ?

Complexity: Time Complexity = n/2(comparisons), Space Complexity = O(1)
i = 1
while i <= n 
  if A[i] == A[i+1]: return A[i]
  i+= 2

return A[n]

Worst case analysis tells that algorithms would stop when i=n-1 and the number of comparisons done is ~ n/2. This is indeed the best in worst case that we can do.
http://algorithmsforever.blogspot.com/2011/10/majority-element.html
Solution (HARD) :
This algorithm uses an observation that if we consider our array to be list of voters and array value is the candidate to whom they are voting, then majority element is the winning candidate.
Additionally, if all other candidates are merged to form one candidate then still it will fail to defeat the majority element candidate (hence the name majority element).
So we can think of it this way. Assuming a negative vote decrease the count of majority element then still the count of majority element would be atleast 1.

int majority_hard(int[] input, int n){
int element = input[0];
int votes = 1;

for(int i=1; i<n; i++){

if(input[i] == element)
votes++;
else if(votes > 0)
votes--;
else {
element = input[i];
votes = 1;
}
}
return element;
}

However, the easy problem may be solved using ~n/2 comparisons using the pigeon hole principle :

Solution (EASY) :
If the total size N is even then, the majority element must duplicate in consecutive positions in some pairs of positions. If N is odd, then it must either duplicate in consecutive positions or must be the last element.

int majority_easy(int[] input, int n){

for(int i=0; i<N; i+=2){
if(input[i] == input[i+1])
return input[i];
}
return input[N];
}
Problem 2: Assume that an integer array A[1..n] has a majority element and elements other than majority element need NOT be distinct. How to find majority element. What's the space and the time complexity of the algorithm?

Complexity: Time Complexity=n(comparison), Space Complexity=O(1)
element = A[1]
votes = 1
for i <- 2 to n:
  if A[i] == element
    votes += 1
  else if votes > 0
    votes -= 1
  else:
    element = A[i]
    votes = 1

return element

Problem 3: Now consider that there are k majority elements, i.e., each of the k majority elements appear in the array more than ceil(n/(k+1)) times. How do we find the k majority elements. (Problem 2 is a special case of this problem with k=1).

Complexity: Time Complexity=k*n(comparison), Space Complexity=O(k)  
for i = 1:n
   // update element count in majority array
   for j = 1:k
      if Maj[j] == A[i] 
         Count[j] += 1
         break
      end
   end
   
   // succeeded in above operation (dont go below)
   if k > j
      continue
   end
   
   // Came here, it means that element not in 
   // majority array (put it in an empty slot)
   for j = 1:k
      if Count[j] == 0
         Maj[j] = A[i] 
         Count[j] = 1
         break
      end
   end
   
   // succeeded in above operation (dont go below)
   if k > j
      continue
   end
   
   // Came here, it means that no empty slow 
   // (decrement counts of all majority elements)
   for j = 1:k
      Count[j] -= 1
   end
end  

The algorithm runs in O(nk) time and takes O(k) extra space. It is easy to see that algorithm finds all the k majority elements. This is becase a non-majority element can knock of all the K majority element once. Since there are less than n - k*ceil(n/(k+1)) (< n/(k+1)) non-majority elements, majority elements will survive in the Maj array.
Read full article from Puzzles, Maths and Algorithms: Finding Majority Element

Labels

LeetCode (1432) GeeksforGeeks (1122) LeetCode - Review (1067) Review (882) Algorithm (668) to-do (609) Classic Algorithm (270) Google Interview (237) Classic Interview (222) Dynamic Programming (220) DP (186) Bit Algorithms (145) POJ (141) Math (137) Tree (132) LeetCode - Phone (129) EPI (122) Cracking Coding Interview (119) DFS (115) Difficult Algorithm (115) Lintcode (115) Different Solutions (110) Smart Algorithm (104) Binary Search (96) BFS (91) HackerRank (90) Binary Tree (86) Hard (79) Two Pointers (78) Stack (76) Company-Facebook (75) BST (72) Graph Algorithm (72) Time Complexity (69) Greedy Algorithm (68) Interval (63) Company - Google (62) Geometry Algorithm (61) Interview Corner (61) LeetCode - Extended (61) Union-Find (60) Trie (58) Advanced Data Structure (56) List (56) Priority Queue (53) Codility (52) ComProGuide (50) LeetCode Hard (50) Matrix (50) Bisection (48) Segment Tree (48) Sliding Window (48) USACO (46) Space Optimization (45) Company-Airbnb (41) Greedy (41) Mathematical Algorithm (41) Tree - Post-Order (41) ACM-ICPC (40) Algorithm Interview (40) Data Structure Design (40) Graph (40) Backtracking (39) Data Structure (39) Jobdu (39) Random (39) Codeforces (38) Knapsack (38) LeetCode - DP (38) Recursive Algorithm (38) String Algorithm (38) TopCoder (38) Sort (37) Introduction to Algorithms (36) Pre-Sort (36) Beauty of Programming (35) Must Known (34) Binary Search Tree (33) Follow Up (33) prismoskills (33) Palindrome (32) Permutation (31) Array (30) Google Code Jam (30) HDU (30) Array O(N) (29) Logic Thinking (29) Monotonic Stack (29) Puzzles (29) Code - Detail (27) Company-Zenefits (27) Microsoft 100 - July (27) Queue (27) Binary Indexed Trees (26) TreeMap (26) to-do-must (26) 1point3acres (25) GeeksQuiz (25) Merge Sort (25) Reverse Thinking (25) hihocoder (25) Company - LinkedIn (24) Hash (24) High Frequency (24) Summary (24) Divide and Conquer (23) Proof (23) Game Theory (22) Topological Sort (22) Lintcode - Review (21) Tree - Modification (21) Algorithm Game (20) CareerCup (20) Company - Twitter (20) DFS + Review (20) DP - Relation (20) Brain Teaser (19) DP - Tree (19) Left and Right Array (19) O(N) (19) Sweep Line (19) UVA (19) DP - Bit Masking (18) LeetCode - Thinking (18) KMP (17) LeetCode - TODO (17) Probabilities (17) Simulation (17) String Search (17) Codercareer (16) Company-Uber (16) Iterator (16) Number (16) O(1) Space (16) Shortest Path (16) itint5 (16) DFS+Cache (15) Dijkstra (15) Euclidean GCD (15) Heap (15) LeetCode - Hard (15) Majority (15) Number Theory (15) Rolling Hash (15) Tree Traversal (15) Brute Force (14) Bucket Sort (14) DP - Knapsack (14) DP - Probability (14) Difficult (14) Fast Power Algorithm (14) Pattern (14) Prefix Sum (14) TreeSet (14) Algorithm Videos (13) Amazon Interview (13) Basic Algorithm (13) Codechef (13) Combination (13) Computational Geometry (13) DP - Digit (13) LCA (13) LeetCode - DFS (13) Linked List (13) Long Increasing Sequence(LIS) (13) Math-Divisible (13) Reservoir Sampling (13) mitbbs (13) Algorithm - How To (12) Company - Microsoft (12) DP - Interval (12) DP - Multiple Relation (12) DP - Relation Optimization (12) LeetCode - Classic (12) Level Order Traversal (12) Prime (12) Pruning (12) Reconstruct Tree (12) Thinking (12) X Sum (12) AOJ (11) Bit Mask (11) Company-Snapchat (11) DP - Space Optimization (11) Dequeue (11) Graph DFS (11) MinMax (11) Miscs (11) Princeton (11) Quick Sort (11) Stack - Tree (11) 尺取法 (11) 挑战程序设计竞赛 (11) Coin Change (10) DFS+Backtracking (10) Facebook Hacker Cup (10) Fast Slow Pointers (10) HackerRank Easy (10) Interval Tree (10) Limited Range (10) Matrix - Traverse (10) Monotone Queue (10) SPOJ (10) Starting Point (10) States (10) Stock (10) Theory (10) Tutorialhorizon (10) Kadane - Extended (9) Mathblog (9) Max-Min Flow (9) Maze (9) Median (9) O(32N) (9) Quick Select (9) Stack Overflow (9) System Design (9) Tree - Conversion (9) Use XOR (9) Book Notes (8) Company-Amazon (8) DFS+BFS (8) DP - States (8) Expression (8) Longest Common Subsequence(LCS) (8) One Pass (8) Quadtrees (8) Traversal Once (8) Trie - Suffix (8) 穷竭搜索 (8) Algorithm Problem List (7) All Sub (7) Catalan Number (7) Cycle (7) DP - Cases (7) Facebook Interview (7) Fibonacci Numbers (7) Flood fill (7) Game Nim (7) Graph BFS (7) HackerRank Difficult (7) Hackerearth (7) Inversion (7) Kadane’s Algorithm (7) Manacher (7) Morris Traversal (7) Multiple Data Structures (7) Normalized Key (7) O(XN) (7) Radix Sort (7) Recursion (7) Sampling (7) Suffix Array (7) Tech-Queries (7) Tree - Serialization (7) Tree DP (7) Trie - Bit (7) 蓝桥杯 (7) Algorithm - Brain Teaser (6) BFS - Priority Queue (6) BFS - Unusual (6) Classic Data Structure Impl (6) DP - 2D (6) DP - Monotone Queue (6) DP - Unusual (6) DP-Space Optimization (6) Dutch Flag (6) How To (6) Interviewstreet (6) Knapsack - MultiplePack (6) Local MinMax (6) MST (6) Minimum Spanning Tree (6) Number - Reach (6) Parentheses (6) Pre-Sum (6) Probability (6) Programming Pearls (6) Rabin-Karp (6) Reverse (6) Scan from right (6) Schedule (6) Stream (6) Subset Sum (6) TSP (6) Xpost (6) n00tc0d3r (6) reddit (6) AI (5) Abbreviation (5) Anagram (5) Art Of Programming-July (5) Assumption (5) Bellman Ford (5) Big Data (5) Code - Solid (5) Code Kata (5) Codility-lessons (5) Coding (5) Company - WMware (5) Convex Hull (5) Crazyforcode (5) DFS - Multiple (5) DFS+DP (5) DP - Multi-Dimension (5) DP-Multiple Relation (5) Eulerian Cycle (5) Graph - Unusual (5) Graph Cycle (5) Hash Strategy (5) Immutability (5) Java (5) LogN (5) Manhattan Distance (5) Matrix Chain Multiplication (5) N Queens (5) Pre-Sort: Index (5) Quick Partition (5) Quora (5) Randomized Algorithms (5) Resources (5) Robot (5) SPFA(Shortest Path Faster Algorithm) (5) Shuffle (5) Sieve of Eratosthenes (5) Strongly Connected Components (5) Subarray Sum (5) Sudoku (5) Suffix Tree (5) Swap (5) Threaded (5) Tree - Creation (5) Warshall Floyd (5) Word Search (5) jiuzhang (5)

Popular Posts