Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            int remove = Convert.ToInt32(textBox2.Text);

            liten.Remove(remove);
            textBox1.Text = liten.ToString();
        }
 //Tar bort ett element ur kön
 public void Dequeue()
 {
     Heapen.Remove(Heapen.Items[0]);
     //for (int i = 0; i < queueHeap.Items.Length; i++)
     //{
     //    if (Equals(queueHeap.Items[i], item))
     //    {
     //        queueHeap.Remove(queueHeap.Items[i]);
     //    }
     //}
 }
Exemplo n.º 3
0
 /// <summary>
 /// tar bort ett element ur heapen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Remove_Click(object sender, EventArgs e)
 {
     try
     {
         heap.Remove(Convert.ToInt32(InputBox.Text));
         HeapNumbers.Text = heap.ToString();
         input.Clear();
     }
     catch (FormatException)
     {
         MessageBox.Show("Invalid input."); //om användaren försöker ta bort siffror ur en tom heap
     }
     catch (IndexOutOfRangeException)
     {
         MessageBox.Show("Invalid input.");
     }
 }
Exemplo n.º 4
0
 private void removeBtn_Click_1(object sender, EventArgs e)
 {
     try
     {
         int  _entry  = Convert.ToInt32(textEntry.Text);
         bool _remove = _heap.Remove(_entry);
         if (_remove == false)
         {
             MessageBox.Show("Number not found.");
         }
         textEntry.Text = "";
         showHeap.Text  = _heap.ToString();
     }
     catch
     {
         MessageBox.Show("Enter a number.");
     }
 }
 /// <summary>
 /// Dequeue-metod, tar bort elementet med den lägsta siffermässiga prioriteten
 /// </summary>
 public void Dequeue()
 {
     queue.Remove(queue.First());
 }
Exemplo n.º 6
0
        public void Dequeue()
        {
            PriorityQueueNode <TKey, TValue> tmpQ = tmpQ = _queue.peek();

            _queue.Remove(tmpQ);
        }