################################################### #!/bin/bash #判断进程是否存在,如果不存在就启动它 PIDS=`ps -ef |grep myprocess |grep -v grep | awk ‘{print $2}‘` if [ "$PIDS" != "" ]; then echo...
分类:
系统相关 时间:
2014-10-21 20:00:40
阅读次数:
288
有如下3种方式:grep -P "\t"awk '/1915848\t/'ctr+c 复制 一个.
分类:
其他好文 时间:
2014-10-21 19:16:45
阅读次数:
120
# Warning! Dangerous step! Destroys VMs for x in $(virsh list --all | grep instance- | awk ‘{print $2}‘) ; do virsh destroy $x ; virsh undefine $x ; done ; # Warning! Dangerous step! Removes lots o...
分类:
其他好文 时间:
2014-10-21 17:57:47
阅读次数:
173
最近学习C++容器,积累一下。下面介绍set和multiset,并使用sort对结构体进行排序。C++之路漫漫其修远兮...
分类:
编程语言 时间:
2014-10-21 17:42:19
阅读次数:
208
插入排序实现:def insert_sort(arr): i =1 while i =0 and arr[j]>key: arr[j+1] = arr[j] j -=1 arr[j+1] = key return arr ...
分类:
编程语言 时间:
2014-10-21 17:14:21
阅读次数:
163
Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort...
分类:
编程语言 时间:
2014-10-21 17:04:11
阅读次数:
226
题目描述:Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order re...
分类:
其他好文 时间:
2014-10-21 00:43:54
阅读次数:
304
我们在算法程序中用的最多的函数就行sort,但经常会忘记如何写比较函数,这里详细做个总结。1) C++中sort函数的原型default (1)template void sort (RandomAccessIterator first, RandomAccessIterator last);c.....
分类:
编程语言 时间:
2014-10-21 00:34:06
阅读次数:
229
编写脚本review.sh: #!/bin/bash
VERSION=`svn?log?-v?--stop-on-copy?$1?|?grep?-B4?"svn?copy"?|?head?-1?|?awk?‘{print?substr($1,2)}‘`
svn?di?-r?${VERSION}:head?$1 用法脚本后跟分支...
分类:
其他好文 时间:
2014-10-20 19:44:34
阅读次数:
194
冒泡排序(Bubble Sort)
是一种简单的排序算法。它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序完成。这个算法的名字由来是因为越小的元素会经由交换慢慢“浮”到数列的顶端。
public class BubbleSort{
public static v...
分类:
编程语言 时间:
2014-10-20 11:45:23
阅读次数:
196