Find Duplicate Elements in an Array – Java Program

Write a java program to find duplicate elements in an array. Given an array of integers, We have to write a code to find all duplicate elements in an array.

For example :

Input : arr = { 2, 5, 3, 1, 8, 7, 5, 3, 2 }

Output: {5, 3, 2}

In this tutorial, I am going to explain three approaches to find duplicate elements in an array. This question is also very importantĀ forĀ technical interviews.

Bubble Sort Program, Algorithm & their Time Complexity

Bubble Sort program, Algorithm & their time complexity.In this tutorial, We are going to learn about bubble sort algorithm and their implementation in various programming languages.

In this tutorial, we are going to cover following things

  • What is Bubble Sort?
  • Bubble sort algorithm & it’s time complexity
  • Bubble sort program in C & C++
  • Bubble sort implementation in PHP

 

What is Bubble Sort?

Bubble sort is a sorting algorithm, It works by comparing each pair of adjacent elements and switching their positions if necessary. It repeats this process until all the elements are sorted.