摘要:
#!/usr/bin/env python # -*- coding: utf-8 -*- def heap_sort(arr): l = len(arr) for i in xrange(l/2, -1, -1): form_heap(arr, i, l-1) for i in xrange(l-1, 0, -1): arr[i],ar... 阅读全文
摘要:
#!/usr/bin/env python # -*- coding: utf-8 -*- def insert_sort(arr): l = len(arr) - 1 for i in xrange(1, l): for j in xrange(i, 0, -1): if arr[j] < arr[j-1]: ... 阅读全文
摘要:
#!/usr/bin/env python # -*- coding: utf-8 -*- #插入排序,缩小增量 def shell_sort(arr): gap = l = len(arr) while(gap > 1): gap = gap/2 for i in xrange(gap, l): for j in xran... 阅读全文
摘要:
#!/usr/bin/env python # -*- coding: utf-8 -*- #冒泡排序 def bubble_sort(arr): l = len(arr) - 1 for i in xrange(0, l): flag = True for j in xrange(0, l - i): if arr[j]... 阅读全文
摘要:
#!/usr/bin/env python # -*- coding: utf-8 -*- #插入排序,缩小增量 def shell_sort(arr): gap = l = len(arr) while(gap > 1): gap = gap/2 for i in xrange(0, l): for j in xrange... 阅读全文
摘要:
java.util.concurrent.Semaphore这个类里面的主要方法为: void acquire():Acquires a permit from this semaphore, blocking until one is available, or the thread isinte 阅读全文
摘要:
java.util.concurrent.CountDownLatch这个类里面的主要方法为: 1.countDown(),Decrements the count of the latch, releasing all waiting threads if the count reaches ze 阅读全文