/*The insert function inserts the element at the bottom
         * of the heap and percolates it up as close as it can get
         * to the top
         */
        public void Insert(Priority _priority, Data _data)
        {
            HeapNode <Priority, Data> nodeToAdd = new HeapNode <Priority, Data>(_priority, _data);

            heap.Add(nodeToAdd);
            percolateUp(heap.Count - 1);
        }
        void Swap(int _pos1, int _pos2)
        {
            HeapNode <Priority, Data> temp = heap[_pos1];

            heap[_pos1] = heap[_pos2];
            heap[_pos2] = temp;
        }
        /*Swap removes the head of the queue and heapify's the
         * rest of the data to keep it in order.*/
        public Data Remove()
        {
            HeapNode <Priority, Data> temp = heap[0];

            Swap(0, heap.Count - 1);
            heap.RemoveAt(heap.Count - 1);
            Heapify(0);

            return(temp.data);
        }