interesting algorithm for cycled linked list.
both recursive and iterative solution added