题意:给你一个无向图,判断是否存在长度为K的环。 思路:dfs遍历以每一个点为起点是否存在长度为k的环。dfs(now,last,step)中的now表示当前点,last表示上一个访问的 点,step一个记录路径长度的计数器,s【i】记录从起点到i点的路径长度。如果某点被访问第二次,则说明出现环,判 ...
分类:
其他好文 时间:
2016-05-25 18:34:08
阅读次数:
208
如何开发一个ServletServlet的映射路径Servlet缺省路径Sevlet的生命周期Servlet的自动加载有参的init方法和无参的init方法Servlet的多线程并发问题ServletConfig对象ServletContext对象4、Servlet的生命周期4.1、引入Servlet的生命周期涉及3个问题:servlet类对象什么时候创建..
分类:
其他好文 时间:
2016-05-23 19:33:26
阅读次数:
210
如果给定的单向链表中存在环,则返回环起始的位置,否则返回为空。最好不要申请额外的空间。...
分类:
其他好文 时间:
2016-05-22 12:24:26
阅读次数:
119
两个思路,一是用哈希表记录每个结点是还被访问过;二是定义两个快、慢指针,如果存在环的话,两个指针必定会在某位结点相遇。 bool linkListNode(ListNode *head) { ListNode *fast=head, *slow=head; while (fast && fast-> ...
分类:
其他好文 时间:
2016-05-21 17:16:15
阅读次数:
130
Linked List Cycle II Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked li ...
分类:
其他好文 时间:
2016-05-20 13:17:32
阅读次数:
120
Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? ...
分类:
其他好文 时间:
2016-05-20 13:14:56
阅读次数:
154
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull. Follow up: Can you solve it without using extra space? ...
分类:
编程语言 时间:
2016-05-18 21:58:35
阅读次数:
138
插件地址: http://jquery.malsup.com/cycle/ <div id="propaganda"><div id="pgdImg"><span id="arrow1" ><img src="images/pgd/arrow1.png" /></span><span id="arr ...
分类:
Web程序 时间:
2016-05-16 10:48:18
阅读次数:
224