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

2014年10月28日

quick sort and find the k largest number in array.

摘要: 1. using priortyqueue. priortyqueue是没有固定size的. http://wlh0706-163-com.iteye.com/blog/1850125 源码PriorityQueue(int initialCapacity, Comparator comparat... 阅读全文

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

2014年10月24日

counting sort ( can sort 0-k Auxiliary Space: O(n+k) Time Complexity: O(n+k) )

摘要: http://www.youtube.com/watch?v=o3FUC6l89tMhttp://www.geeksforgeeks.org/counting-sort/only 0 - k can not be negtive71522 最大7.new array(7).0 1 2 3 4 5... 阅读全文

posted @ 2014-10-24 06:25 brave_bo 阅读(164) 评论(0) 推荐(0)

weather station observer

摘要: public interface Subject {public void registerObserver(Observer o);public void removeObserver(Observer o);public void notifyObservers();}public interf... 阅读全文

posted @ 2014-10-24 03:11 brave_bo 阅读(215) 评论(0) 推荐(0)

2014年10月18日

facebook -- Typeahead Search

摘要: https://www.facebook.com/video/video.php?v=432864835468首先先看演讲. 太有营养了.1, trie .is straight forward, butwaste space, thrashes cache.1.points are huge.2.... 阅读全文

posted @ 2014-10-18 06:02 brave_bo 阅读(335) 评论(0) 推荐(0)

2014年10月17日

sort algorithm

摘要: insert sort:merge sort:其实很像后续遍历.package com.java2novice.sorting; public class MyMergeSort { private int[] array; private int[] tempMergArr;... 阅读全文

posted @ 2014-10-17 04:27 brave_bo 阅读(182) 评论(0) 推荐(0)

2014年10月15日

find the deepest node in a binary tree

摘要: Find the deepest node in a binary tree:Example:A/ \B C/ \ / \D E F G\HReturn Node ‘H’public class test { //unsigned 2^32-1 so we need a long to ins... 阅读全文

posted @ 2014-10-15 02:49 brave_bo 阅读(162) 评论(0) 推荐(0)

2014年10月12日

Lowest Common Ancestor of a Binary Tree Part

摘要: bottom-uppackage test.ui;import java.util.HashSet;import java.util.Set;public class test { //unsigned 2^32-1 so we need a long to instead. pub... 阅读全文

posted @ 2014-10-12 05:51 brave_bo 阅读(167) 评论(0) 推荐(0)

Balanced Binary Tree

摘要: /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ... 阅读全文

posted @ 2014-10-12 05:33 brave_bo 阅读(201) 评论(0) 推荐(0)

Lowest Common Ancestor of a Binary Tree Part I

摘要: 456789101112131415161718192021// Return #nodes that matches P or Q in the subtree.int countMatchesPQ(Node *root, Node *p, Node *q) { if (!root) retur... 阅读全文

posted @ 2014-10-12 05:18 brave_bo 阅读(177) 评论(0) 推荐(0)

Splitting Linked List

摘要: This is a very good linked list question, as there are tricky cases you have to consider, and getting them all right in one place is harder than it lo... 阅读全文

posted @ 2014-10-12 04:17 brave_bo 阅读(200) 评论(0) 推荐(0)

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

导航