• 16 June

    Java Thread Join Example

    In this post, we will see about Java thread join method. Thread class’s join() method can be used to stop current execution of thread until thread it joins, completes its task. So basically, it waits for the thread on which join method is getting called, to die.For example: Here when you call t1.join(), main thread […]

  • 14 June

    Java Thread Sleep

    Sleep method of java.lang.Thread is used to pause current execution of thread for specific period of time. Some important points about sleep method are : It causes current executing thread to sleep for specific amount of time. Its accuracy depends on system timers and schedulers. It keeps the monitors it has acquired, so if it […]

  • 14 June

    Java Thread example

    Thread can be called as light weight process. Java supports multithreading , so it allows your application to perform two or more task concurrently.  Multithreading can be of advantage specially when now a days, machine has multiple CPUs, so multiple tasks can be executed concurrently. Whenever we call main method in java, it actually creates […]

  • 05 June

    Introduction to complexity of algorithm

    “How will you calculate complexity of algorithm” is very common question in interview.How will you compare two algorithm? How running time get affected when input size is quite large? So these are some question which is frequently asked in interview.In this post,We will have basic introduction on complexity of algorithm and also to big o […]

  • ConcurrentHashMap in java
    26 November

    ConcurrentHashMap in java

    ConcurrentHashMap was introduced in Java 5 with other concurrency utils such as CountDownLatch, CyclicBarrier and BlockingQueue. ConcurrentHashMap in java is very similar to HashTable but it provides better concurrency level. You might know , you can synchonize HashMap using Collections.synchronizedMap(Map). So what is difference between ConcurrentHashMap and Collections.synchronizedMap(Map)In case of Collections.synchronizedMap(Map), it locks whole HashTable […]

  • 04 August

    Binary tree in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. This is 1st part of java binary tree tutorial. Binary tree in java Binary tree preorder traversal Binary tree postorder traversal Binary tree inorder traversal Binary tree level order traversal Binary tree spiral order traversal Binary tree […]

  • 04 August

    print all paths from root to leaf in a binary tree in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. This is 9th part of java binary tree tutorial. In this post, we will see about program to print all paths from root to leaf in a binary tree in java. Below diagram will show all paths […]

  • 04 August

    Spiral/Zigzag level order traversal of binary tree in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. This is 6th part of java binary tree tutorial. In this post, we will see about Spiral/Zigzag Level Order binary tree traversal in java. Spiral/Zigzag Level Order traversal: Spiral/Zigzag Level order traversal of below tree will be: […]

  • 20 July

    How to Print Leaf Nodes of a Binary Tree in Java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. 1. Introduction In this post, we will see how to count leaf nodes in a binary tree in Java. Understanding how to count leaf nodes is useful for various applications in computer science, such as calculating the […]