Class Mode
java.lang.Object
topics.divideconquer.Mode
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Mode
public Mode()
-
-
Method Details
-
mode1
public void mode1(int[] v, int[] mo) This method iteratively computes the predominant element (mode). It is quadratic O(n^2)- Parameters:
v- Array used to calculate the modemo- Array with the solution (value and repetitions)
-
mode2
public void mode2(int[] v, int[] mo) This method previously orders the vector O(nlogn) and then it looks for the mode O(n). It is O(nlogn) + O(n) - O(nlogn). It is DandC because of the Quicksort sorting- Parameters:
v- Array used to calculate the modemo- Array with the solution (value and repetitions)
-