Getting the indices of an unsorted double array after sorting
问题 This question comes as a companion of this one that regarded fastest sorting of a double array. Now I want to get the top- k indices corresponding to the unsorted array. I have implemented this version which (unfortunately) uses autoboxing and HashMap as proposed in some answers including this one: HashMap<Double, Integer> map = new HashMap<Double, Integer>(); for(int i = 0; i < numClusters; i++) { map.put(scores[i], i); } Arrays.sort(scores); HashSet<Integer> topPossibleClusters = new