This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
给定一个有序列表l,用最快的方法找出数x在其中的位置 | |
""" | |
l = [1, 3, 4, 12, 34, 62, 77, 79, 88, 90, 99] | |
x = 77 | |
""" | |
思路,先找出数组l的中间值,和x比较大小,若比x大,则x在l的前半部分, | |
再在l的前半部分的列表ll中,按以上方法判断x的位置 | |
""" |
NewerOlder