public static void Main(String[] args)
        {
            DoubleSpring ds = new DoubleSpring();

            Console.WriteLine("Enter Name-");
            var input = Console.ReadLine();

            ds.Expand(input);
            Console.WriteLine("Enter Name-");
            input = Console.ReadLine();
            ds.Expand(input);
            Console.WriteLine("Enter Name-");
            input = Console.ReadLine();
            ds.Expand(input);
            Console.WriteLine("Enter Name-");
            input = Console.ReadLine();
            ds.Expand(input);
            Console.WriteLine("Enter Name-");
            input = Console.ReadLine();
            ds.Expand(input);
            Console.WriteLine($"No of Elements-{ds.Count()}");
            foreach (var i in ds)
            {
                Console.WriteLine(i);
                Console.WriteLine("-------------");
            }
            ds.Compress();
            Console.WriteLine($"No of Elements-{ds.Count()}");
            foreach (var j in ds)
            {
                Console.WriteLine(j);
                Console.WriteLine("-------------");
            }
        }
Beispiel #2
0
        public static void Main(String[] args)
        {
            DoubleSpring <int> ds1 = new DoubleSpring <int>();

            ds1.Expand(1);
            ds1.Expand(2);
            ds1.Expand(3);
            ds1.Expand(4);
            ds1.Expand(5);
            foreach (var k in ds1)
            {
                Console.WriteLine(k);
                Console.WriteLine("-------------");
            }
            ds1.Compress();
            foreach (var k in ds1)
            {
                Console.WriteLine(k);
                Console.WriteLine("-------------");
            }
        }