تم الحل ✓
categoryهندسة الحاسبات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Question 3: (20 marks)
Find the complexity of the following blocks of code or algorithm's description.
[Note: your answer must show the steps that lead to your final answer] (4 marks each)
1) count=1
for i = 1 to 100 do
count += i
for k = 1 to 100 do
count *=k
while j < n do
count +=j
1-2;
end while
2) def Process (int n):
if (n == 0)
do one arithmetic operation
else
for (i = 1; i < n; i++)
Process(i)
3) The algorithm solves the problem of 4) The algorithm solves the problem
size n by dividing it into 8 sub-
problems of size n/2, recursively
solving each sub-problem, and then
combining the solutions in O(n³)
time
5) The algorithm solves the problem of
size n by recursively solving two
sub-problems of size n - 1, and
then combining the solutions in
constant time.
Note:
by breaking it into 4 sub-problems
of 1/2 the scale, recursively
solving each sub-maze, and then
combining the solutions in linear
time
You should submit all your answers in one big word file.
Criterion
Unsatisfactory
Average
Algorithm
Design
Incomplete
Complete but
looks like an
Implementation
Using Python
Complexity
analysis
Incomplete
Poor use of
white space
(indentation, blank
lines, ambiguous
naming of
variables)
essay not a
professional
algorithm
Organized
work, with correct
use of space,
variables, and
naming.
Incomplete
No answer
answer or
partially correct
Irrelevant text or some effort but
Report
no answer.
the report is not
organized
Good
100% Complete and in a
na professional format
Explanation of the pseudo-code is provided
looks efficient in terms of running time and of
memory usage
Comments on the efficiency
Completed 100%
Comments on the code
Screen shot of the run and comments.
Organized indentation with good use of variables
Tested with any simple input case study.
Documented briefly in terms of (input, output,
functions purposes)
Completed 100%
Explanation is provided
logical representation of the arguments in terms
of problem's categories, solving technique.
complexity, memory consumption and ending with
a correct conclusion.
End of Assessment
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.