示例#1
0
 public SeLinkList()
 {
     prev  = null;
     next  = null;
     a     = 0;
     b     = 0;
     c     = 0;
     index = indexCounter;
     indexCounter++;
 }
示例#2
0
 public SeLinkList(int _a, int _b, int _c)
 {
     next  = null;
     prev  = null;
     a     = _a;
     b     = _b;
     c     = _c;
     index = indexCounter;
     indexCounter++;
 }
示例#3
0
        public void PrintList()
        {
            Console.WriteLine("Printing list::");
            SeLinkList data = head;

            while (data != null)
            {
                data.print();
                data = data.next;
            }
        }
示例#4
0
        public int findMinWeight()
        {
            int        smallestWeight = Int32.MaxValue;
            SeLinkList lightest       = null;
            SeLinkList current        = head;

            while (current != null)
            {
                if (current.GetWeight() < smallestWeight)
                {
                    smallestWeight = current.GetWeight();
                    lightest       = current;
                }
            }
            Console.WriteLine("MIN: " + lightest.GetWeight());
            return(lightest.GetWeight());
        }
示例#5
0
        public int findMaxWeight()
        {
            int        largerWeight = Int32.MinValue;
            SeLinkList heaviest     = null;
            SeLinkList current      = head;

            while (current != null)
            {
                if (current.GetWeight() > largerWeight)
                {
                    largerWeight = current.GetWeight();
                    heaviest     = current;
                }
            }
            Console.WriteLine("MAX:: " + heaviest.GetWeight());
            return(heaviest.GetWeight());
        }
示例#6
0
        //similar to the push method of a double linked list
        public void AddPlayer(int a, int b, int c)
        {
            SeLinkList newPlayer = new SeLinkList(a, b, c);

            if

            (head == null)
            {
                head = newPlayer;
            }
            else
            {
                SeLinkList current = head;
                while (current.next != null)
                {
                    current = current.next;
                }

                current.next   = newPlayer;
                newPlayer.prev = current;
            }

            numPlayers++;
        }
示例#7
0
 public Players()
 {
     numPlayers = 0;
     head       = null;
 }