MAD101_-_SU_2024_-_Block_5_-_FE_2635.webp
D

MAD101_-_SU_2024_-_Block_5_-_FE_2635.webp

Kizspy | Question: 16
(Choose 1 answer)
Given the Insertion sort algorithm (See picture)
If input = 7, 2, 4, 3, 1, 6, 5, after running the outer loop with i = 3, the order of the elements in the list is___
A. 2, 4, 7, 3, 1, 6, 5
B. 2, 4, 7, 1, 3, 6, 5
C. 2, 3, 4, 7, 1, 6, 5
D. 1, 2, 3, 4, 7, 6, 5
Procedure Insertionsort(a1,a2,..., an: integer)
for i = 2 to n do j: = 1 while a; < a₁j: = j+1 temp: = a₁fork : i down to j+1 ax:= ak-1
a; := temp

Thông tin

Category
MAD101
Thêm bởi
deep_ocean
Ngày thêm
Lượt xem
4,083
Lượt bình luận
11
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom