Professional Documents
Culture Documents
Lab Exam Cs263: Dev Juneja 202011020
Lab Exam Cs263: Dev Juneja 202011020
Dev Juneja
202011020
Question 2
Code :
import java.util.*;
}
public static void main(String[] args) {
int [] arr = {5,4,3,5,3,2,5,1,1,7,1,2,3,3,3,6};
int [] newArr = new Main(arr).remoDupEle();
System.out.println(Arrays.toString(newArr));
}
}
Output :
Algorithm :
Quick Sort :
Explanation :
Time complexity of sorting elements is O(nlogn) (quick sort).
After sorting, finding duplicate elements will take the time
complexity of O(n). Therefore, the overall complexity of this
algorithm will be O(nlogn).
Assumption:
Input must be an Integer Array