logo

Crowdly

Browser

Add to Chrome

Computer Science / Rekenaarwetenskap - 144

Looking for Computer Science / Rekenaarwetenskap - 144 test answers and solutions? Browse our comprehensive collection of verified answers for Computer Science / Rekenaarwetenskap - 144 at stemlearn.sun.ac.za.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

This double loop fills an n-by-n matrix. Its running time as a function of n is:

for i in range(n):

for j in range(n):

c[i][j] = 1.0 if i == j else 0.0

0%
0%
100%
0%
View this question

Towers of Hanoi and 'print all subsets of n elements' both run in time proportional to 2ⁿ. This order of growth is called:

0%
0%
100%
0%
View this question

Why does concatenating a single character onto a string take time proportional to the string's current length (not constant time)?

100%
0%
0%
0%
View this question

Insertion sort takes about 8 seconds to sort 10 000 random ints. Using its order of growth, roughly how long to sort 20 000 random ints?

0%
0%
0%
100%
View this question

n items are added to an empty list. Loop L uses a.insert(0, x) each time; loop R uses a.append(x) each time. Which loop is quadratic?

100%
0%
0%
0%
View this question

Scanning a sorted array from the front (brute-force linear search) to find a random PRESENT key uses, on average, about:

100%
0%
0%
0%
View this question

Why does the text prefer tilde (~) / order-of-growth notation over big-O for PREDICTING performance?

0%
0%
100%
0%
View this question

Compared with insertion sort, mergesort (as in merge.py) needs:

0%
100%
0%
0%
View this question

Insertion sort does the MOST work (about n²/2 compares) on which input?

100%
0%
0%
0%
View this question

Consider building a reversed copy of a string s of length n. Because strings are immutable, the running time is:

reverse = ''

for i in range(n):

reverse = s[i] + reverse

0%
100%
0%
0%
View this question

Want instant access to all verified answers on stemlearn.sun.ac.za?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome