`
文章列表
#coding=utf-8 ''' Created on 2012-5-28 @author: air ''' import os,sys print sys.platform import getpass print getpass.getuser() # 获取系统的用户名 print os.environ['USERNAME']# 获取系统的用户名 print os.path.getsize('log.txt')#返回文件的大小 ex=compile('100+2000',                                  '',' ...
package com.agl.exea.book; public class MegerSort { public static void main(String[] args){ int[] a = {2,3,1,9,50,-1}; meger(a,0,a.length-1); for(Integer i: a){ System.out.print(i+"**"); } } public  static void meger(int[] a,int left ,int right){ if(left==righ ...
#!/usr/bin/python #coding=utf-8 import sys sys.path.append('/home/administrator/python_dir/tools') from Stack import Stack num_stack = Stack() operator_stack = Stack() brackets_stack = Stack() import char_tools def execute_express(press):     i=0;     while i < len(press):         char = press[ ...

车位模拟

#!/usr/bin/python #coding=utf-8 import Queue import random class Park(object):     def __init__(self,max=10):         self.max = max         self.size=self.max         self.queue=Queue.Queue(self.max)         self.park_db={}                 while self.queue.full() is not True:              i = rand ...
#!/usr/bin/python #coding=utf-8 ''' 冒泡排序算法 ''' def sort(array):    i = 0    len_array = len(array)    while i < len_array:       j=i+1       while j < len_array:          if array[j] > array[i]: tmp = array[j] array[j] = array[i] array[i] = tmp          j = j+1       i = i+1 if __n ...

while,if使用

while使用: #! /bin/bash while echo "im a shell" do    mkdir adir    cd adir    touch afile    sleep 10s done if-else: #! /bin/bash if [ -f "a" ] ; then    echo "文件存在" else    echo "文件不存在";    touch a;    echo "sdfsfsfs">>a fi
package com.jdk.api; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorCompletionService; import ...
package com.algorithm.complex; public class SubMax { public static void main(String[] args){ int[] a= {1,-87,8,66,-78,600,2}; System.out.println(subMax(a,0,a.length-1)); } public static int subMax(int[] array,int left,int right){         if(left == right){               ...
Global site tag (gtag.js) - Google Analytics