An iterative way of writing quick sort:
#include
#include
#include
using namespace std;
void quickSort(int A[], int n) {
stack> stk;
stk.push(make_pair(0, n-1));
while (!stk.empty()) {
pair ...
分类:
其他好文 时间:
2014-06-03 00:16:43
阅读次数:
357
进来复习了一下C语言指针,一直没有写过太多关于函数指针的代码,而且对回调函数的理解一直都是在理论上,基本上没有太写过关于它的代码,进来得空,写了一个小程序加深下自己对回调函数和函数指针的理解。
问题描述: 编写一个sort()函数,使它能够对任何类型的数组元素进行排序。
下面是我写的代码:
/*
使用函数指针的回调函数技巧,设计一个能排序int 和char 数组的sort()函...
分类:
其他好文 时间:
2014-06-02 23:16:49
阅读次数:
471
【题目】原文:1.3 Design an algorithm and write code
to remove the duplicate characters in a string without using any additional
buffer. NOTE: One or two add...
分类:
其他好文 时间:
2014-06-02 21:32:04
阅读次数:
284
// OpenGL.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include
#include
#include
using namespace std;
void init(void)
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
glShadeMod...
分类:
其他好文 时间:
2014-06-02 11:02:18
阅读次数:
282
Sort ListSort a linked list inO(nlogn) time
using constant space
complexity.要求时间复杂度为O(nlogn),那么不能用quickSort了(最坏O(n^2)),所以使用mergeSort.通常写排序算法都是基于数组的,这题...
分类:
其他好文 时间:
2014-06-02 06:29:51
阅读次数:
192
EXP/IMP 命令参数[转贴 2009-9-24 14:16:48]字号:大中小一、EXP:
1、完全: EXP SYSTEM/MANAGER BUFFER=64000 FILE=C:\FULL.DMP FULL=Y
如果要执行完全导出,必须具有特殊的权限 2、用户模式: EXP SONIC/SO...
分类:
其他好文 时间:
2014-06-02 06:27:59
阅读次数:
239
<!DOCTYPEhtml>
<html>
<headlang="en">
<metacharset="UTF-8">
<title>数组</title>
<scripttype="text/javascript">
vara1=[1,4,5,7,8];
vara2=newArray(‘b‘,‘a‘,‘d‘);
a1.sort(function(i,j){
returni-j;
});
a2.sort();
consol..
分类:
编程语言 时间:
2014-06-02 04:05:42
阅读次数:
354
class Solution {
public:
void swap(int &a,int &b)
{
int t=a;
a=b;
b=t;
}
void ksort(int l,int h,int a[])
{
if(h<l+2)
return;
int e=h,p=l;
while(...
分类:
其他好文 时间:
2014-06-02 03:01:26
阅读次数:
206
当您使用资源浏览器查看文件时,您能够随心所欲的按名称、大小、类型及改动日期不同的列对文件进行大小排序。.Net提供的ListView组件没有直接提供这样的功能,但要实现并不难。
ListView.Sort()方法的功能是“对列表视...
分类:
其他好文 时间:
2014-06-02 00:03:13
阅读次数:
241
接口是一组对类的需求描述,这些类要遵从接口描述的统一格式进行定义。
“如果你的类遵从某个特定接口,那么我就履行这项服务”。
一个具体的例子:Arrays类中的sort方法承诺可以对对象数组进行排序,但要求满足一个前提:对象所属的类必须实现了Comparable接口。
如:
class Employee implements Comparable{
private doubl...
分类:
编程语言 时间:
2014-06-01 15:42:18
阅读次数:
349