Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import random
- import heapq
- # import cProfile
- def circleMST(n):
- E = [-2] * (n - 1)
- for i in range((n - 1) * (n - 2) / 2):
- d = random.uniform(0, 2)
- if d < -E[0]:
- heapq.heappop(E)
- heapq.heappush(E, -d)
- print -sum(E)
- if __name__ == "__main__":
- if len(sys.argv) > 1:
- testMST(int(sys.argv[1]))
- else:
- print("No valid argument")
- # cProfile.run('circleMST(10000)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement