|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
Write a function defined as:
def num_matches_jump_search (or_list, match, jump = 1):
that implements a jump search that takes the size of the jump (jump >= 1) as an input parameter to find the value match. If that value is found, the function should then use linear search to discover all adjacent values that also match to the match parameter. The search should return the number of items in the ordered list that match the search value (rather than the index) or False if the item was not found.
For example:
num_matches_jump_search ([0, 2, 3, 5, 5, 6, 8, 11, 12, 12, 12], 5, 2) == 2
为什么系统告诉我list index out of range
求大佬解答,我对比一下自己的答案 |
|