May/June 2020 COS2611 Programming: Data Structures
Question 1 Program Analysis [10] For each of the following questions choose the correct alternative. Questions 1.1, 1.2 and 1.3 refer to the following code fragment. 1 for(int j = 10; j = n; j++ ) 2 for(int k = 1; k = n; k*=2 ) 3 sum++; 4 for(int p = n; p 1; p/=2 ) 5 for(int q = 0; q 500; q+=4 ) 6 sum--; 1.1. How many times is statement 3 executed? A. O(N) B. O(N2 ) C. O(N3 ) D. O(N log N) E. O(log N) 1.2. How many times is statement 6 executed? A. O(N) B. O(N2 ) C. O(N3 ) D. O(log N) E. O(N log N)
Geschreven voor
- Instelling
- University of South Africa
- Vak
- COS2611 - Programming Data Structures
Documentinformatie
- Geüpload op
- 10 oktober 2021
- Aantal pagina's
- 10
- Geschreven in
- 2021/2022
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
cos2611
-
mayjune 2020 cos2611 programming data structures