示例#1
0
文件: helper.cs 项目: Mexahoid/CSF
        //ref u
        /*   public bool Check()
           {
               Node p = head;
               bool u = true;
               if (p != null)
                   do
                   {
                       if (p.inf > p.next.inf)
                           u = false;

                   } while (p != null);

                   return u;
           }*/
        public bool Check()
        {
            Node p = head;
            bool u = true;
            for (int i = 0; i < count; i++)
            {

                if (p != null)
                // do
                {
                    if ((p.inf > p.next.inf) && (u == true))
                    {
                        u = false;
                        head = head.next;
                        count--;
                    }
                    else
                    {
                        head = head.next;
                        count--;
                    }
                    //  } while (p != null);
                }
            }
            return u;
        }
示例#2
0
文件: helper.cs 项目: Mexahoid/CSF
 // положить в хвост очереди
 public void InQueue(int inf)
 {
     Node p = new Node(inf, null);
     if (QueueIsEmpty())
     {
         head = p; tail = p;
     }
     else
     {
         tail.next = p; tail = p;
     }
     count++;
 }
示例#3
0
文件: helper.cs 项目: Mexahoid/CSF
 // взять из головы очереди
 public int OutQueue()
 {
     Node p = head;
     head = head.next;
     count--;
     return p.inf;
 }
示例#4
0
文件: helper.cs 项目: Mexahoid/CSF
 public MyQueue()
 {
     head = null; tail = null; count = 0;
 }
示例#5
0
文件: helper.cs 项目: Mexahoid/CSF
 // Конструктор
 public Node(int inf, Node next)
 {
     this.inf = inf;
     this.next = next;
 }