Menampilkan postingan dengan label data structure and algorithmTunjukkan semua

Bucket Sort in Java with Example

In recent years, one of the question I have increasingly seen in programming job interviews is about constant time sorting algorithms e.g.…


How to Count Number of Leaf Nodes in Binary Tree - Java Iterative and Recursive Algorithm

You can use the same algorithm to count a number of leaf nodes in the binary tree which we have used in the last article, while printing al…


How to find square root of a number in Java - Algorithm Interview question

Write a program to calculate the square root of a number in Java or C++ is one of the popular coding interview questions from Programming j…


Post Order binary tree traversal in Java - Recursion and Iteration

This is the third article on tree traversal. In the last couple of articles, I have shown you how to implement preorder and inorder trave…


How to check if two Rectangle Overlap in Java - Algorithm

Can you write a Java program to check if two rectangles are overlapping with each other or not? is one of the frequently asked coding ques…


Iterative QuickSort Example in Java - without Recursion

The quicksort algorithm is one of the important sorting algorithms. Similar to merge sort, quicksort also uses divide-and-conquer hence it…


How to Print all Leaf Nodes of Binary tree in Java - Recursion and Stack

Binary tree based questions are very common in Java or any other Programming job interviews. One of the frequently asked binary tree questi…


InOrder traversal of Binary tree in Java using Recursion and Iteration

This is the second article about tree traversal algorithms using Java. In the first part , we have seen the pre-order algorithm for visitin…


How to find the 3rd element from end in linked list in Java

The problem to find the 3rd element from the end in a singly linked list or nth node from the tail is one of the tricky but frequently aske…


Binary Tree PreOrder Traversal in Java - Recursion and Iteration Example

Unlike linked list and array which can only be traversed linearly, there are several ways to traverse a binary tree. The tree traversal alg…


How do you find length of a Singly Linked list using Loop and Recursion

Hi Guys, Here is one of the classical programming questions asked to me first time on an interview with multinational Investment bank. Afte…


How to Reverse Array in Java - Int and String Array Example

This Java tips is about, how to reverse array in Java, mostly primitive types e.g. int , long , double and String arrays. Despite of Java…


How to generate MD5 Hash in Java - String Byte Array digest Example

There are multiple ways to generate the MD5 hash in Java program. Not only Java API provides a convenient method for generating MD5 hash, y…


Top 15 Data Structures and Algorithm Interview Questions for Java programmer - Answers

Data structures and algorithm questions are an important part of any programming job interview, be it a Java interview, C++ interview or an…


2 ways to combine Arrays in Java � Integer, String Array Copy Example

There are multiple ways to combine or join two arrays in Java, both for primitive like int array and Object e.g. String array. You can even…


How to compare Arrays in Java � Equals vs deepEquals Example

java.util.Arrays class provides equals() and deepEquals() method to compare two Arrays in Java. Both of these are overloaded method to …


Recursion in Java with example � Programming Techniques Tutorial

Recursion is one of the tough programming technique to master. Many programmers working on both Java and other programming languages like C…


3 Example to print array values in Java - toString and deepToString from Arrays

Printing array values in Java or values of array element in Java would have been much easier if arrays are allowed to directly prints its …


4 ways to search Java Array to find an element or object - Tutorial Example

Searching in Java Array sounds familiar? should be, because its one of frequently used operations in Java programming. Array is an index b…