This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits./stdc++.h> | |
using namespace std; | |
int duplicate_hashing(int arr[], int n) | |
{ | |
//Create a boolean value of size n | |
bool flag[n]; | |
//Set all values of flag boolean array initially as false | |
fill(flag, flag + n, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int sorting_duplicate(int arr[], int n) | |
{ | |
//Sort the array using STL sort function or write own sorting algorithm(merge sort or heap sort) | |
sort(arr, arr + n); | |
for (int i = 1; i < n; i++) | |
{ | |
//As the list is sorted,if two consecutive values are found, return the value as it is duplicate |
NewerOlder