## ♦ Is it a valid binary search tree (BST) ?

Q. Write code test if a given tree is a binary search tree (i.e. BST)? A. A binary search tree (BST) is a binary tree where each node satisfies the following conditions: 1) key in any node is larger than the keys in all nodes in that node’s left subtree…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Coding, member-paid, Tree structure

## 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 returns true, else returns false? Considerations: Should it work for negative integers? How big is the inputNumbers array? How often…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in Array Structure, member-paid

## ♥ 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 values: int numbers[ ]={5,2,4,3,1}. The program computes the sum of first 5 elements and stores them at element 6, computes the

Posted in Array Structure
Tags: ,

## 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 linear search algorithm’s two advantages are simplicity and the ability to search either sorted or unsorted one-dimensional arrays. Its sole…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Searching Algorithms

## Quick Sort in Java

Q. Is there a more efficient sorting algorithm than bubble sorting? A. Although bubble-sort is one of the simplest sorting algorithms, it’s also one of the slowest. It has the O(n2) time complexity. Faster algorithms include quick-sort and heap-sort. The Arrays.sort( ) method uses the quick-sort algorithm, which on average…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Sorting Algorithms

## 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 or not, traversal is forward only or bi-directional, inserts at the end only or any arbitrary position, more inserts or

Posted in Best Practice, Which Data Structure & WHy

## ♥ Big O notation questions and answers

Q1. What do you know about the big-O notation and can you give some examples with respect to different data structures? A1. The Big-O notation simply describes how well an algorithm scales or performs in the worst case scenario as the number of elements in a data structure increases. The

Posted in Big O notation

## Single Pointer: Partitioning around a pivotal number

Q. How will you partition the following numbers 7 3 6 8 2 9 5 4 around the pivotal number of 5 so that the lower values are in front of it and higher values are behind it? A. A single pointer can be used by moving from left to…...

## Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Pointer Algorithms
Page 1 of 512345