摘要:
/* * 1.5CopyStandardInputToStandardOutputUsingStandardIO.cpp * * Created on: Feb 10, 2015 * Author: sunyj */
#include "../apuesunyj.h" /*
The standard I/O functions provide a buffered... 阅读全文
posted @ 2015-02-10 20:55
孙永杰
阅读(191)
评论(0)
推荐(0)
摘要:
// 1.4CopyStandardInputToStandardOutput.cpp
#include "../apuesunyj.h" #define BUFFSIZE 4096 int main()
{ int n; char buf[BUFFSIZE]; // By convention, all shells open three descriptors ... 阅读全文
posted @ 2015-02-10 19:55
孙永杰
阅读(305)
评论(0)
推荐(0)
摘要:
// 1.3ListAllTheFilesInADirectory.cpp#include #include "../apuesunyj.h"int main(int argc, char *argv[]){ DIR* dp; struct dirent* dirp; if (2 != argc) ... 阅读全文
posted @ 2015-02-10 19:10
孙永杰
阅读(231)
评论(0)
推荐(0)
摘要:
// apuesunyj.h#ifndef APUE_SUNYJ#define APUE_SUNYJ#include #include #include #include #include #include void err_quit(const char *fmt, ...);void err_s... 阅读全文
posted @ 2015-02-10 17:46
孙永杰
阅读(207)
评论(0)
推荐(0)
摘要:
将所有/etc/yum.repos.d/下面的文件,中https更改为http,避免yum问题sudo yum -y install vnc-server 阅读全文
posted @ 2015-02-10 13:59
孙永杰
阅读(119)
评论(0)
推荐(0)
摘要:
#include #include #include #ifdef __linux
#include #include #endif void swap(int64_t* A, uint64_t i, uint64_t j)
{ int64_t tmp = A[i]; A[i] = A[j]; A[j] = tmp;
} int64_t ... 阅读全文
posted @ 2015-02-10 10:56
孙永杰
阅读(679)
评论(1)
推荐(0)
摘要:
以下摘自网络 随机化快排:快速排序的最坏情况基于每次划分对主元的选择。基本的快速排序选取第一个元素作为主元。这样在数组已经有序的情况下,每次划分将得到最坏的结果。一种比较常见的优化方法是随机化算法,即随机选取一个元素作为主元。这种情况下虽然最坏情况仍然是O(n^2),但最坏情况不再依赖于输入数据,而是由于随机函数取值不佳。实际上,随机化快速排序得到理论最坏情况的可能性仅为1/(2^n)。所以随机化... 阅读全文
posted @ 2015-02-10 10:00
孙永杰
阅读(540)
评论(0)
推荐(0)

浙公网安备 33010602011771号