Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Written by *** and Eric Martin for COMP9021
- from random import seed, shuffle
- import sys
- # for_seed is meant to be an integer, length a strictly positive integer.
- # length will not be large for most tests, but can be as large as 10_000_000.
- def generate_permutation(for_seed, length):
- seed(for_seed)
- values = list(range(1, length + 1))
- shuffle(values)
- return values
- def maps_to(values, x):
- new_values = list(range(1, x + 1))
- new_values = sorted(values)
- print(new_map_values)
- return new_values
- # REPLACE PASS ABOVE WITH YOUR CODE
- def length_of_cycle_containing(values, x):
- pass
- # REPLACE PASS ABOVE WITH YOUR CODE
- # Returns a list of length len(values) + 1, with 0 at index 0
- # and for all x in {1, ..., len(values)}, the length of the cycle
- # containing x at index x.
- def analyse(values):
- pass
- # REPLACE PASS ABOVE WITH YOUR CODE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement