码迷,mamicode.com
首页 >  
搜索关键字:swap nodes in pairs    ( 8848个结果
Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:其他好文   时间:2014-05-16 23:18:16    阅读次数:360
第七章 快速排序
快速排序最坏情况下时间复杂度是O(n*n),但是它平均时间复杂度是O(N*logn),并且常数因子很小,可实现就地排序,所以被作为内排序的常用排序方法. #include using namespace std; void swap(int &i,int &j) { int temp=i; i=j; j=temp; } int partition(int *vector...
分类:其他好文   时间:2014-05-15 06:05:35    阅读次数:254
LeetCode-004 Add Two Numbers
【题目】 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Out...
分类:其他好文   时间:2014-05-15 05:13:49    阅读次数:306
Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码 题目描述: A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than t...
分类:其他好文   时间:2014-05-15 05:09:59    阅读次数:351
solaris x86安装ORACLE 11.2.0.3软件时因SWAP不足报错: INFO: ld: fatal: mmap anon failed
1.ORACLE软件安装到86%时报错,图忘截了。日志如下: /oracle/u01/app/oracle/product/11.2.0/ INFO: db_1/lib/sysliblist` -R /opt/SUNWcluster/lib -R/export/home/oracle/u01/app/oracle/product/11.2.0/db_1/lib -R /opt/ORCLcl...
分类:数据库   时间:2014-05-15 05:00:12    阅读次数:334
(求通俗易懂的证法) 过n个有标志顶点的树的数目等于n^(n-2)
最近一段时间是决定好好把算法大体学一遍了。今天发现了一个有趣的定理:cayley’s theorem: 过n个有标志顶点的树的数目等于n^(n-2)。以4个nodes的树为例,应该是16个没错,然后找了好半天也没有找到能看懂的证明过程。如果有哪位有发现比较易懂的证法,欢迎和我在留言讨论。:)
分类:其他好文   时间:2014-05-13 18:25:06    阅读次数:183
算法导论第六章 堆排序
建堆的时间复杂度是O(n),堆排序的时间复杂度是O(NLogN),具体算法如下所示: #include using namespace std; void swap(int &i,int &j) { int temp=i; i=j; j=temp; } void shiftDown(int *A, int start,int len) { int temp=A[...
分类:其他好文   时间:2014-05-13 13:55:15    阅读次数:270
Counting Inversion Pairs in an Array
Given an array, for example, 246135, an inversion pair is the pair whose first value is larger than its second value according to the sequence from left to right, (2,1) (4,1) (4,3) (6,1) (6,3) (6,5)....
分类:其他好文   时间:2014-05-13 08:03:58    阅读次数:338
HDU 4028 The time of a day STL 模拟题
暴力出奇迹。。 #include #include #include #include #include #include #include #include using namespace std; #define ll __int64 #define N 42 ll n,m,ans; ll Gcd(ll x,ll y){ if(x>y)swap(x,y); while(x){ y%=...
分类:其他好文   时间:2014-05-12 23:11:06    阅读次数:445
【LeetCode】Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:其他好文   时间:2014-05-11 18:15:52    阅读次数:300
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!