Top Java Data Structures and Algorithm Interview Questions
Q: Write a Java program to elements using Bubble Sort algorithm?
Q: Write a Java program to elements using Counting Sort algorithm?
A: In computer science, counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting the number of objects that have each distinct key value, and using arithmetic on those counts to determine the positions of each key value in the output sequence. Its running time is linear in the number of items and the difference between the maximum and minimum key values, so it is only suitable for direct use in situations where the variation in keys is not significantly greater than the number of items. However, it is often used as a subroutine in another sorting algorithm, radix sort, that can handle larger keys more efficiently.
Implement Counting Sort using Java + Performance Analysis
Q: What is Circular Queue? Why should we use it? Implement it using Java
A:Circular Queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the last position is connected back to the first position to make a circle.
In a normal Queue Data Structure, we can insert elements until queue becomes full. But once if queue becomes full and later if elements are dequeued, we have to shift all the elements every time an element is to be inserted in the queue.
Implement Circular Queue using Java
Q: Write a java program for finding next palindrome number.
A:For a given number, find the next immediate palindrome larger than the number. For example if the number is 103 the immediate palindrome will be 111.
Finding Next Palindrome Number using Java
Q: Write a java program for checking if Java Array contains a certain value.
A:Check if Java Array contains certain value
Q: How to check if Linked List has a loop?
Q: How to reverse a String in Java?
Q: What is binary search tree?
Q: How to traverse a Binary Tree?
Q: Write a java program to check if String is palindrome or not?
Q: How to find maximum element in binary tree?
Q: Find second largest number in an array?