public class SetTest { public static void
main(String[] args) { Set set = new HashSet(); List list = new ArrayList();
list.add...
分类:
其他好文 时间:
2014-05-16 07:18:35
阅读次数:
263
题目: Sort a linked list inO(nlogn) time using
constant space complexity.解题思路: 复杂度为O(n* logn)
的排序算法有:快速排序、堆排序、归并排序。对于链表这种数据结构,使用归并排序比较靠谱。递归代码如下:代码: /...
分类:
其他好文 时间:
2014-05-16 05:49:04
阅读次数:
266
题目: Sort a linked list using insertion sort.解题思路:
假设 list[1..i]是排好序的,找到第i+1个元素应该插入的位置及其前驱,然后将其插入。代码: /** * Definition for
singly-linked list. * str...
分类:
其他好文 时间:
2014-05-16 05:47:08
阅读次数:
258
题目链接题意: 给出单链表头指针head和整数n, 要求删除链表的倒数第n个结点,
这里n保证是合法的输入.我的思路....其实我没大明白题目建议的one pass是什么意思, 可能就是遍历一遍链表的,
不过我还是秉着能A掉就万岁的心态...我还是首先记录了链表的长度, 然后删除第len - n +...
分类:
其他好文 时间:
2014-05-16 05:45:56
阅读次数:
348
题目: Given a linked list, determine if it has a
cycle in it. Follow up: Can you solve it without using extra space?解题思路:
使用快慢指针,快指针每次走两步,慢指针每次走一步...
分类:
其他好文 时间:
2014-05-16 05:19:21
阅读次数:
271
DBMS_XPLAN包包括一系列函数,主要是用于显示SQL语句的执行计划,且不同的情形下使用不同的函数来显示,如预估的执行计划则使用display函数,而实际的执行计划则是用display_cursor函数,对于awr中的执行计划,则是用display_awr函数,而SQL
tuning集合...
分类:
数据库 时间:
2014-05-16 04:58:05
阅读次数:
429
准备工作: SQL> conn sys/root as sysdba
Connected. SQL> grant select on v_$sql_plan to scott; Grant succeeded.
SQL> grant select on v_$session to scott; Gr...
分类:
数据库 时间:
2014-05-16 04:56:06
阅读次数:
431
题目: 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 extr...
分类:
其他好文 时间:
2014-05-16 04:50:13
阅读次数:
329
import java.util.ArrayList;import
java.util.Calendar;import java.util.List;import java.util.Random;import
java.util.Date;import java.text.DateFormat;i...
分类:
Web程序 时间:
2014-05-15 15:41:06
阅读次数:
413
在学习Stl的过程中,经常看到->符号的重载,但一直不太明白。
今天做了一个小测试,来看看如果调用它。 以list的迭代器为例,在 pointer operator->() const { return
&(operator*());}中加入 cout str_list; str_list.push...
分类:
其他好文 时间:
2014-05-14 10:32:52
阅读次数:
221