//counting sort
计数排序//参考算法导论8.2节#include#include#include#includeusing namespace std;const int
k=5;const int n=7;int a[n]={5, 5, 1, 2 , 5, 4, 1};int b[...
分类:
其他好文 时间:
2014-06-12 23:08:11
阅读次数:
237
RS,ORS,FS,OFS,NR,NF,$0,$nRS输入的行分隔号ORS输出的行分隔号FS输入的列分隔号OFS输入的列分隔号NR行号NF尾列号$0表示所有列(整行)$n表示第n列例如:cataa123456awk‘ORS=",\n"{print}‘aa12,34,56,RS反之awk‘OFS="|"{print$1,$2}‘1|23|45|6FS反之ifconfig|awk-F"[|:]+"‘NR==2..
分类:
其他好文 时间:
2014-06-10 23:39:38
阅读次数:
258
最近在写一个检查一台服务器上所有游戏区服配置文件中redis某个key值大小的脚本,本打算使用shell+awk+sed的方式去解决这个问题,但是由于redis的配置信息是php数组形式.shell脚本一时没有写出来,就请教他人帮忙写了个python脚本,但是自己python不是很精通,于是按照脚本中涉及到..
分类:
数据库 时间:
2014-06-10 22:50:12
阅读次数:
360
这是一个群里别人让我写的一个小脚本,当做练习发到这里,功能很简单,从一个文件里面提取域名,之后利用nslookup命令对域名进行解析,再按照固定的格式输出到一个新的文件里面(输出规格是为address=/域名/IP),脚本内容如下:#!/bin/bash
fornamein`cat/root/dns.File`;do
n..
分类:
其他好文 时间:
2014-06-10 22:35:33
阅读次数:
355
双向冒泡 1 package com.huang; 2 3 public class
_014_bubb_sort { 4 5 int[] b={1,2}; 6 static int
a[]={12,4,35,65,43,63,2,6,9,544,43543}; 7 pu...
分类:
编程语言 时间:
2014-06-10 21:43:40
阅读次数:
275
问题:对链表进行排序,要求时间复杂度为NlogN。归并排序。
inline ListNode* getMidle(ListNode *head){
if(NULL == head || NULL == head->next)
return head;
ListNode *pslow = head;
ListNode *pfast = head;
while (pfast->next...
分类:
其他好文 时间:
2014-06-10 17:35:56
阅读次数:
282
package chap06_Heap_Sort;import static
org.junit.Assert.*;import java.util.ArrayList;import java.util.Arrays;import
org.junit.Test;/** * 优先队列,二叉堆数组实现,...
分类:
其他好文 时间:
2014-06-10 16:40:14
阅读次数:
347
Sort a linked list using insertion sort. 1 /**
2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 *
ListNode *nex...
分类:
其他好文 时间:
2014-06-10 12:14:19
阅读次数:
253
以后尽量能用迭代就别用递归啊,递归只是让自己轻松了,但是却增加了电脑的负担。 package
chap06_Heap_Sort;import static org.junit.Assert.*;import java.util.Arrays;import
org.junit.Test;public ...
分类:
其他好文 时间:
2014-06-10 11:57:27
阅读次数:
252
binary search\sort\find operations
status InsertNode(Node* root, data x, Node* father)
{
if(root==NULL)
{
if(father==NULL)
Tree empty;
else
{
if(xdata)
{
father->left=new Node//inital l...
分类:
其他好文 时间:
2014-06-10 08:09:49
阅读次数:
234