Ejemplo n.º 1
0
        public LlNode <T> Chain(T data)
        {
            var node = new LlNode <T>(data);

            Next = node;
            return(node);
        }
Ejemplo n.º 2
0
        public static bool Find <T>(LlNode <T> root)
        {
            if (root == null || root.Next == null)
            {
                return(false);
            }
            var slow = root.Next;
            var fast = root.Next.Next;

            while (fast != null && slow != null)
            {
                if (slow.Data.Equals(fast.Data))
                {
                    return(true);
                }
                slow = slow.Next;
                fast = fast.Next.Next;
            }

            return(false);
        }