Sunday, 30 April 2017

Inorder Traversal Binary Tree Java Program

Binary Tree Inorder Traversal in Java


In Inorder traversal, Left subtree is read first then Root Node and then Right subtree.

Inorder traversal of Binary Tree is very popular interview question.
 
There are 2 ways to do Inorder traversal,
1. Recursive Inorder traversal of Binary tree.
2. Iterative Inorder traversal of Binary tree.
   
Inorder traversal example.


Postorder Traversal Java Program

Binary Tree Postorder Traversal in Java


Postorder traversal is one of the way to traverse binary Tree. In postorder traversal Left subtree is read first then Right subtree and then Root Node.

Binary Tree Postorder traversal algorithm is a very popular interview question so better to understand it properly.

There are 2 ways of doing Postorder traversal,
  1. Recursive Postorder traversal of Binary tree.
  2. Iterative Postorder traversal of Binary tree.

Friday, 28 April 2017

Binary Tree Preorder Traversal in Java

Binary Tree Preorder Traversal in Java


Preorder traversal is one of the way to traverse the binary Tree. In Preorder traversal Root node is read first then Left child and at last Right child.

Binary Tree Preorder traversal is a very popular interview question so better to understand it properly.

There are 2 ways to doing Preorder traversal,
  1. Recursive Preorder traversal of Binary tree.
  2. Iterative Preorder traversal of Binary tree.

Wednesday, 19 April 2017

Top 25 Java Multithreading Interview Questions Answers for Experienced

Top 25 Java Multithreading Interview Questions Answers.
Interview Questions on Threads in Java.


In this post, we will cover common Java Multithreading interview questions answers for freshers and experienced.

Question 1. What are Threads in Java?

In Java, when a program requires more than one task to execute in parallel, say for example,
  1. Reading a data from a local file.
  2. Reading a data from remote connection.
When both of above task need to be executed in parallel at that time Threading will come in picture.
So Java Threads helps creating multiple independent path of execution within a program which can run parallely.  

Monday, 10 April 2017

Configure Angular2 + Webpack + Maven Sample

Configure Angular2 + Webpack in Maven build.


Build application using Angular2 with Typescript, Webpack as Module Bundler and Maven as build environment. We will also use Angular 2 with bootstrap.js and jquery.js library

What is Webpack

Webpack is a powerful module bundler. A bundle is common JavaScript file that combine html data, css data, javascript data etc in common file together and should be served to the client in a response to a single file request. 



Let's start building application using Angular2 and Typescript. 
We will use Bootstrap + Jquery with Angular2 and Typescript in our sample application.

Download application from github: Angular2WebPackMaven

How output will look like:

Angular2 Typescript files:

1. index.html
    Application single page application html file which contain placeholder to display   
    components. 

2. main.ts
    Application entry point file, this is the place where we have imported all application 
    dependencies.

    index.html is simply a template, Required javascript's, css etc are mentioned in main.ts
    Also, which module to load in placeholder is also present in main.ts 

3. app folder
    It contains application typescript files (modules, component, services, routes, models etc)

4. resources folder
    It contains application external resources like javascript, css etc that need to be bundled.

5. package.json
    A package.json file contains meta data about our app. 
    It includes list of dependencies to install for development and production environment.

6. webpack.config.js
    Webpack configuration file


Download code from link : Angular2WebPackMaven


Steps to run the application:

1. After downloading the application, run "mvn install" in home directory as shown below,
    (It will take some time to download all development dependencies)

2. For running the application, go to browser and hit 
    "http://ip:port/Angular2WebPackMaven/angular2-webpack-maven"

You may also like to see


Number Range Spinner in Angular JS

Download binary file AngularJS + REST service

What is Websocket? How Websocket works? Program on updating total count of connected Clients.

Using JQuery Datatable with AngularJS

Top 25 Multithreading Interview Questions In Java

Enjoy !!!! 

If you find any issue in post or face any error while implementing, Please comment.