COMS W1004 Lecture Notes - Lecture 1: Selection Sort, Insertion Sort, Binary Number

172 views2 pages
Computer Science 1004
Introduction to Computer Science
Sample Midterm Questions
Version 1.0
1) Linear (sequential) search has an efficiency on the order of _____ where n is the
number of items being searched.
a) lg n
b) n
c) n2
d) n * lg n
e) lg n2
For questions 2-4, consider the integer array below.
2) Which of the following lists of numbers would accurately show the array after
the second pass through the Insertion Sort algorithm as seen in class (sorting in
increasing order)?
a) 1, 2, 20, 5. 15, 8, 9
b) 1, 2, 5, 20, 15, 8, 9
c) 1, 5, 20, 2, 15, 8, 9
d) 1, 2, 5, 15, 20, 8, 9
e) 1, 5, 2, 20, 15, 8, 9
3) Which of the following lists of numbers would accurately show the array after
the second pass of the Selection Sort algorithm as seen in class (sorting in
increasing order)?
a) 1, 2, 20, 5. 15, 8, 9
b) 1, 2, 5, 20, 15, 8, 9
c) 1, 5, 20, 2, 15, 8, 9
d) 1, 2, 5, 15, 20, 8, 9
e) 1, 5, 2, 20, 15, 8, 9
4) How many comparisons between elements does Insertion Sort make when
sorting this array?
a) 12
b) 13
c) 14
d) 21
e) 49
5 1 20 2 15 8 9
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions