Beispiel #1
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());
        }
Beispiel #2
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());
        }