示例#1
0
        public static void DisplaySimpleLinkedListClass()
        {
            SimpleLinkedList <int> list = new SimpleLinkedList <int>();

            list.SetSortRule(SetArrayStandard);

            list.Insert(11);
            list.Insert(11);
            list.Insert(22);
            list.Insert(22);
            list.Insert(33);

            Console.WriteLine("현재 데이터의 수 : " + list.CountData);
            Console.WriteLine(list);

            list.RemoveData(22);

            Console.WriteLine("현재 데이터의 수 : " + list.CountData);
            Console.WriteLine(list);
        }
示例#2
0
        public static void DisplayQuest4()
        {
            SimpleLinkedList <Point> list = new SimpleLinkedList <Point>();

            list.Insert(new Point(2, 1));
            list.Insert(new Point(2, 2));
            list.Insert(new Point(3, 1));
            list.Insert(new Point(3, 2));

            list.SetSortRule(delegate(Point left, Point right)
            {
                if (left.X < right.X)
                {
                    return(true);
                }
                if (left.X != right.X)
                {
                    return(false);
                }
                return(left.Y < right.Y);
            });

            Console.WriteLine(list);
        }