【剑指offer】面试题28:弦乐

def Permutation(data, i):
	if len( data ) == 0:
		return
	# i stand for the start of first part
	for i in range(i, len( data ) - 1):
		# j stand for the start of second part
		for j in range(i + 1, len( data )):
			# swap the items of two part
			data[i], data[j] = data[j], data[i]

			Permutation(data, i + 1)

			# for next swap, we should recorver the last swap
			data[i], data[j] = data[j], data[i]
			

版权声明:本文博主原创文章。博客,未经同意不得转载。

原文地址:https://www.cnblogs.com/lcchuguo/p/4854572.html