摘要:
There are three types of depth-first traversal: pre-order,in-order, and post-order.For a binary tree, they are defined as operations recursively at ea... 阅读全文
摘要:
一、判断链表是否存在环,办法为:设置两个指针(fast, slow),初始值都指向头,slow每次前进一步,fast每次前进二步,如果链表存在环,则fast必定先进入环,而slow后进入环,两个指针必定相遇。二、找到环的入口点当fast若与slow相遇时,slow肯定没有走遍历完链表,而fast已经... 阅读全文