This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| public List<List<Integer>> levelOrder(TreeNode root) { | |
| List<List<Integer>> list = new ArrayList<>(); | |
| Queue<TreeNode> q = new java.util.LinkedList<TreeNode>(); | |
| ArrayList<Integer> level; | |
| if(root!=null){ | |
| level = new ArrayList<Integer>(); | |
| level.add(root.val); | |
| list.add(level); | |
| q.add(root); | |
| level = new ArrayList<Integer>(); |
| public class ExampleTwo { | |
| public static void myExample(){ | |
| System.out.println("Hello there, you have reached personal website of Sreeprasad"); | |
| } | |
| public static void main(String[] args) { | |
| Thread t = new Thread(ExampleTwo::myExample); | |
| t.start(); | |
| } |
| Runnable aRunnableObject = () -> System.out.println("Hello CrowdTwist !"); |
| public class ExampleThree{ | |
| private static int bal=0; | |
| public static void updateBal(){ | |
| bal+=10; | |
| bal-=10; | |
| } | |
| public static void monitorBal(){ |
| public class ThreadJoin{ | |
| public static void main(String[] args) { | |
| Thread t = new Thread(ThreadJoin::print); | |
| t.start(); | |
| try{ | |
| t.join(); | |
| }catch(InterruptedException e){ | |
| System.out.println(e); |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
#System Design Cheatsheet
Picking the right architecture = Picking the right battles + Managing trade-offs
##Basic Steps
This gist started with a collection of resources I was maintaining on stream data processing — also known as distributed logs, data pipelines, event sourcing, CQRS, and other names.
Over time the set of resources grew quite large and I received some interest in a more guided, opinionated path for learning about stream data processing. So I added the reading list.
Please send me feedback!
| import java.util.Collection; | |
| import java.util.Map; | |
| import java.util.Map.Entry; | |
| import java.util.Set; | |
| import java.util.WeakHashMap; | |
| import java.util.concurrent.ConcurrentHashMap; | |
| import java.util.concurrent.DelayQueue; | |
| import java.util.concurrent.Delayed; | |
| import java.util.concurrent.TimeUnit; |