sudo yaourt -S google-talkplugin
if there's no video, then add this
sudo echo "O3D_OVERRIDE_RENDER_MODE=2D" >> /opt/google/talkplugin/envvars
# Max heap for all nodes in array: A[ parent(i) ] >= A[i]
for nodes in array: insert node insert: 1: append to the end of the heap (the last leaf) 2: compare with my parent 3: swap if i'm greater than my parent 4: goto 2
#!/usr/bin/python import random import heapq def mk_heap (arr): heap = [''] for i in arr: heap.append(i) l = len(heap) - 1 while l >= 2 and heap[l] < heap[l//2]: heap[l], heap[l//2] = heap[l//2], heap[l] l = l // 2 print heap[1:] if __name__ == '__main__': arr = range (1, 20) random.shuffle(arr) brr = arr print "before heapify" print arr print "my make heap:" mk_heap(arr) h = [] for i in brr: heapq.heappush(h, i) print "using heapq:" print h
before heapfy [14, 11, 19, 2, 3, 10, 5, 13, 8, 15, 16, 1, 18, 9, 17, 4, 7, 6, 12] my make heap: [1, 3, 2, 4, 11, 5, 9, 7, 6, 15, 16, 19, 18, 10, 17, 14, 8, 13, 12] using heapq: [1, 3, 2, 4, 11, 5, 9, 7, 6, 15, 16, 19, 18, 10, 17, 14, 8, 13, 12]