测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A43679. 下方代码段通过插入排序的方法完成排序,空白处应补充的代码是(def insertion_sort(arr): for i in range(1, len(arr)): current = arr[i] pre_index = i - 1 whilepre_index >= 0 and arr[pre_index] > current: ______________________________…

单选题 较难

题目描述

下方代码段通过插入排序的方法完成排序,空白处应补充的代码是(

def insertion_sort(arr):

     for i in range(1, len(arr)):

         current = arr[i]

         pre_index = i - 1

         whilepre_index >= 0 and arr[pre_index] > current:

                 _________________________________

                 pre_index -= 1

         arr[pre_index + 1] = current

     return arr

选项(单选)

上一题 下一题