Exemplo n.º 1
0
        public static int alabama(Nodeint n)
        {
            Nodeint nt;

            nt = n;
            int sum = 0;

            while (nt.HasNext())
            {
                sum += nt.GetValue();
                nt   = nt.GetNext();
            }
            sum += nt.GetValue();
            return(sum);
        }
Exemplo n.º 2
0
        public static string Print(Nodeint n)
        {
            Nodeint n1;

            n1 = n;
            string str = "";

            str = str + n1.ToString() + " ";
            while (n1.HasNext())
            {
                n1  = n1.GetNext();
                str = str + n1.ToString() + " ";
            }
            return(str);
        }
Exemplo n.º 3
0
        public static Nodeint RetNoNeg(Nodeint n)
        {
            Nodeint nt;
            Nodeint nextnt;

            nt = n;
            while (nt.HasNext())
            {
                nextnt = nt.GetNext();
                if (nextnt.GetValue() < 0)
                {
                    nt.SetNext(nextnt.GetNext());
                }
                nt = nt.GetNext();
            }
            return(n);
        }