コード例 #1
0
        //----------------------------------------------------------------------------------------------------------
        //Индексы интервалов с наибольшими значениями частот
        public int[] GetMaxFrequencyIntervalsIndecies(int count)
        {
            int[] intervalsIndecies = new int[count];
            Dictionary <int, double> frequenciesDictionary = ArrayOperator.GetDictionary(this.frequencyValues);
            int index = 0;

            while (index < count)
            {
                double maxFrequencyValue = 0;
                int    maxFrequencyIndex = 0;
                foreach (KeyValuePair <int, double> keyValuePair in frequenciesDictionary)
                {
                    double value          = keyValuePair.Value;
                    int    frequencyIndex = keyValuePair.Key;
                    if (maxFrequencyValue < value)
                    {
                        maxFrequencyValue = value;
                        maxFrequencyIndex = frequencyIndex;
                    }
                }
                intervalsIndecies[index] = maxFrequencyIndex;
                frequenciesDictionary.Remove(maxFrequencyIndex);
                index++;
            }
            return(intervalsIndecies);
        }