For loop with Set, is it O(n)?

KaraS

New Member
I have this for loop:\[code\]public void method(int[] arr) { Set set = new HashSet(); for(int i = 0; i < arr.length; i++){ set.add(arr); }}\[/code\]is this method in O(n)?
 

DrWatson

New Member
No sure what are you asking for but you have passed a parameter incorrectly in the method. Define the array in the main class.
 
Top