Blog Archives
1 2 3

10: Part-3: Java Tree structure interview and coding questions

This is an extension to Java Tree structure interview and coding questions — Part 2, and adds functional programming and recursion. Step 1: The Tree interface with get( ) method that …



11: Part 4: Java Tree structure interview and coding questions

This is an extension to Java Tree structure interview questions and coding questions — Part 3 where recursion was used for FlattenTree interface. Let’s use iteration here. Step 1: The FlattenTree  interface.



9 Java Data structures best practices

#1: Choose the right type of Java data structure based on usage patterns

like fixed size or required to grow, duplicates allowed or not, ordering is required to be maintained …



Beginner array coding problems in Java

More Data Structure and Algorithms Coding Questions and answers in Java.

Q1. Write a program that allows you to create an integer array of 5 elements with the following …



Big O notation questions and answers with Java examples

The Big O notation and Java data structures go hand-in-hand in coding tests & job interviews Q1. What do you know about the big-O notation and can you give some …



Find 2 numbers from an array that add up to the target

Q1. Given an array of integers, find two numbers such that they add up to a specific target number? For example, Given numbers: {2, 3, 8, 7, 5} Target number: …



Find middle element of a LinkedList in one pass Java example

The SinglyLinkedList was created in the post “LinkedList creating from scratch in Java”. This extends “SinglyLinkedList” post. Q. How to find the middle node of a linked list in a …



Find pair of numbers with a given sum in Java

Q. Write a method which takes the parameters (int[ ] inputNumbers, int sum) and checks input to find the pair of integer values which totals to the sum. If found …



Graph from scratch Java example

Q. Java does not have a Graph implementation, how would you go about implementing your own? A. Graphs are data structures that represent arbitrary relationships between members of any data …



Graph from scratch Java example adjacent matrix approach

Q. Java does not have a Graph implementation, how would you go about implementing your own? A. Graphs are data structures that represent arbitrary relationships between members of any data …



HashMap from scratch Java example

Q. If Java did not have a HashMap implementation, how would you go about writing your own one? A. Writing a HashMap is not a trivial task. It is also …



Linear & Binary Search in Java

Q. Can you write a code to search for number 5 in 7 3 6 8 2 9 5 4? A. The code below uses the linear search algorithm. The …



LinkedList creating from scratch in Java

Q. How to create a LinkedList from scratch A. Adding Removing Step 1: The node that stores the data and the reference to the next Node.



1 2 3

300+ Java Interview Questions - FAQs

Tutorials on Java & Big Data