Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            linkedList linkedList = new linkedList();

            linkedList.add(1);
            linkedList.add(2);
            linkedList.add(3);
            linkedList.add(4);
            linkedList.add(5);

            linkedList.moveFirst();

            while (linkedList.cur != null)
            {
                Console.WriteLine(linkedList.cur.value);
                linkedList.next();
            }

            Console.ReadKey();

            linkedList.moveLast();

            while (linkedList.cur != null)
            {
                Console.WriteLine(linkedList.cur.value);
                linkedList.pre();
            }
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main()
        {
            linkedList test       = new linkedList();
            var        fileStream = new FileStream(@"names.txt", FileMode.Open, FileAccess.Read);
            node       current    = test.front;

            //int inputCode;
            using (var streamReader = new StreamReader(fileStream)){
                string line;
                int    inputCode;
                //int currentCode;
                while ((line = streamReader.ReadLine()) != null)
                {
                    inputCode = test.makeNameCode(line);
                    //currentCode = test.makeNameCode(current.name);

                    /*if(inputCode < currentCode){
                     *  //test.addBefore(line, current);
                     * }
                     * else if(inputCode > currentCode){
                     *  //test.addAfter(line, current);
                     *  //while(current.next.name <)
                     * }*/
                    //test.add(line);
                    //Console.WriteLine(test.makeNameCode(line));
                }
            }
            test.test();
            test.print();



            //for(int i = 0; i < 5; i++){
            //    test.addLast(i.ToString());
            //}
            //test.print();
            //Console.WriteLine("\nnow reverse\n");
            //test.reverse();
            //test.sortAlphabetical();
            // Console.Write("Sum of x + y = "+ z);
        }