public static void Create()
        {
            int[] a = { 10, 12, 1, 5, 6 };
            CircularLinkedList dl = new CircularLinkedList();

            for (int i = 0; i < a.Length; i++)
            {
                dl.Head = dl.InsertAtEnd(dl.Head, a[i]);
            }
        }
Пример #2
0
        private bool searchCombination()
        {
            Node <Zero> current       = circularList.head;
            int         countOfSucces = 0;

            do
            {
                CircularLinkedList <Zero> succesZero = new CircularLinkedList <Zero>();
                succesZero.Add(current.Data);
                for (int a = 0; a < circularList.Count; a++)
                {
                    countOfSucces = 0;
                    for (int b = 0; b < succesZero.Count; b++)
                    {
                        if (circularList[a].Data.i != succesZero[b].Data.i & circularList[a].Data.j != succesZero[b].Data.j)
                        {
                            ++countOfSucces;
                        }
                    }
                    if (countOfSucces == succesZero.Count)
                    {
                        succesZero.Add(circularList[a].Data);
                    }
                    if (countOfSucces == matrix.height)
                    {
                        break;
                    }
                }

                if (countOfSucces == matrix.height)
                {
                    foreach (var item in succesZero)
                    {
                        Console.WriteLine((item.i + 1) + " " + (item.j + 1));
                    }
                    return(true);
                }



                current = current.Next;
            } while (current != circularList.head);
            return(false);
        }