Ejemplo n.º 1
0
        public int getKthLargest(int[] array, int k)
        {
            if (k < 1 || k > array.Length)
            {
                throw new ArgumentException();
            }

            foreach (int item in array)
            {
                customHeaps.Insert(item);
            }

            for (int i = 0; i < k - 1; i++)
            {
                customHeaps.Remove();
            }

            return(customHeaps.Max());
        }
Ejemplo n.º 2
0
 public int Dequeue()
 {
     return(customHeaps.Remove());
 }