[关闭]
@w1024020103 2017-05-25T11:33:43.000000Z 字数 361 阅读 523

Study Guide : Sorting I (Basic Sorts)

CS61B


Overview

image_1bgupv26t9kgsag1ob91tln148i9.png-102.4kB

image_1bguq338n8h3onvj7ls7ff2cm.png-84.9kB

B level

1、Give a best and worst case input for insertion sort.

best case: abcde
worst case: edcba

2、Which sort do you expect to run more quickly on a reversed array, selection sort or insertion sort?
See sorting comparisons (lec30) guide for more questions that involve all of our sorting algorithms.

seems to be the same. both are O(N^2)

see discussions here

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注