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!

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

Appending n items one at a time to an initially empty Python list takes total time proportional to:

0%
0%
100%
0%
View this question

What is the order of growth of x after this code runs?

x = 0

for i in range(n):

for j in range(n):

for k in range(n):

x += 1

100%
0%
0%
0%
View this question

What is the order of growth of the running time of this function?

def f(n):

if n == 0:

return 1

return f(n-1) + f(n-1)

0%
0%
0%
100%
View this question

You run a doubling test on two Section 4.2 sorting functions. For f the successive running-time ratios settle near 4; for g they settle near 2. Which pairing is correct?

100%
0%
0%
0%
View this question

For which input does insertion sort run in LINEAR time in n?

100%
0%
0%
0%
View this question

Using the text's memory model, an array (Python list) holding 1000 int objects (each in the normal 64-bit range) uses about:

0%
0%
100%
0%
View this question

A program's worst-case running time is O(n²). According to the text, which statement is TRUE?

0%
100%
0%
0%
View this question

For n a power of 2, mergesort is linearithmic because:

0%
100%
0%
0%
View this question

In the worst case, the number of compares binary search uses on a sorted array of n keys has order of growth:

0%
0%
0%
100%
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