快速排序主要就是partition的操作。排序主体/* 递归的实现。A[] -->要排序的数组, s --> 开始位置, e --> 结束位置 */
void quickSort(int arr[], int s, int e)
{
if (s < e)
{
int p = partition(arr, s, e); /* Partitioning index *...
分类:
编程语言 时间:
2015-07-06 19:57:12
阅读次数:
119
1Palindrome Partitioning问题来源:Palindrome Partitioning该问题简单来说就是给定一个字符串,将字符串分成多个部分,满足每一部分都是回文串,请输出所有可能的情况。 该问题的难度比较大,很可能第一次遇到没有思路,这很正常。下面我们一点点分析,逐步理清思路。先...
分类:
编程语言 时间:
2015-06-17 23:04:56
阅读次数:
208
题目链接 题目要求: Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possib...
分类:
其他好文 时间:
2015-06-16 16:08:21
阅读次数:
120
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs...
分类:
其他好文 时间:
2015-06-11 14:20:49
阅读次数:
93
3-way partitioning:
将数组分为三份:(小于、等于、大于拆分值)
?Let v be partitioning item a[lo].
?Scan i from left to right.
– (a[i] v): exchange a[gt...
分类:
其他好文 时间:
2015-06-11 13:03:13
阅读次数:
142
正常dfspublic class Solution { public ArrayList> partition(String s) { ArrayList> res = new ArrayList>(); if(s==null||s.length()==0) re...
分类:
其他好文 时间:
2015-06-11 12:27:43
阅读次数:
98
题目:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representat...
分类:
其他好文 时间:
2015-06-09 06:13:42
阅读次数:
93
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example,...
分类:
其他好文 时间:
2015-06-06 21:57:41
阅读次数:
122
// uva 11584 Partitioning by Palindromes 线性dp
//
// 题目意思是将一个字符串划分成尽量少的回文串
//
// f[i]表示前i个字符能化成最少的回文串的数目
//
// f[i] = min(f[i],f[j-1] + 1(j到i是回文串))
//
// 这道题还是挺简单的,继续练
#include
#include
#include
#i...
分类:
其他好文 时间:
2015-06-03 23:37:32
阅读次数:
325
题目:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representat...
分类:
其他好文 时间:
2015-06-03 15:33:00
阅读次数:
168