1a. Find all the inversions in the permutation (5, 3, 6, 2, 7, 8, 4, 1). Which are consecutive inversions? 1b. Now write a Python function find_inv(perm) that returns a list (in any order) of all the non-consecutive inversions in the given permuation. For example, find_inv([2, 4, 1, 3, 5]) should return [(2, 1), (4, … Continue reading "Finding all the inversions in a permutation"
The post Finding all the inversions in a permutation appeared first on 100% Private Proxies - Fast, Anonymous, Quality, Unlimited USA Private Proxy!.