近似回文词Problem's Link:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1328Mean:略。analyse:直接暴力枚举每一个终点,然后枚举回文串的半径即可。Time complexity:O(n*m)Source code:// ...
分类:
其他好文 时间:
2014-10-03 20:27:25
阅读次数:
235
[leetcode]Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity....
分类:
其他好文 时间:
2014-10-02 11:43:22
阅读次数:
165
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.方法一:暴力破解,1和2合并,合并后再和3合并,合并后再和4合并。。。如此下去一直将所有链表节点全部合并完。...
分类:
其他好文 时间:
2014-10-01 12:19:11
阅读次数:
252
here are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O...
分类:
其他好文 时间:
2014-09-30 00:05:21
阅读次数:
274
Sort a linked list inO(nlogn) time using constant space complexity.1、分析该题主要考查了链接上的合并排序算法。2、正确代码实现package com.edu.leetcode;import com.edu.leetcode.List...
分类:
编程语言 时间:
2014-09-29 03:09:07
阅读次数:
315
题目描述:Sort a linked list inO(nlogn) time using constant space complexity.解题方案:题目要求的时间复杂度是O(nlogn),常数级空间复杂度。所以这里用了归并排序,归并排序在数组上操作比较方便,但是这里要排序的是链表。我们用到两个...
分类:
其他好文 时间:
2014-09-27 18:56:10
阅读次数:
231
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
分类:
其他好文 时间:
2014-09-24 17:45:07
阅读次数:
214
UVA586 - Instant Complexity(递归加模拟)
题目链接
题目大意:给你一段代码,要求你算复杂度。OP代表操作,Loop代表循环,end结束。
解题思路:递归去模拟。具体看代码。
代码:
#include
#include
const int N = 15;
char s1[N], s2[N];
typedef long long ll;
ll...
分类:
其他好文 时间:
2014-09-24 12:16:56
阅读次数:
179
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:
其他好文 时间:
2014-09-21 19:36:11
阅读次数:
172