-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomework1.java
More file actions
49 lines (40 loc) · 899 Bytes
/
Homework1.java
File metadata and controls
49 lines (40 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package task3;
public class Homework1 {
/*
Какова временная сложность?
task#1 O(n)
START
READ number n
IF n==1 THEN return
FOR i=1, i<=n, i+1
print "*"
END
===========================================================================
task#2 O(n log n)
START
READ number n
numbers i=0, j=0, a=0
FOR i=n/2, i<n; i+1
FOR j=2, j<n, j*2
a=a+n/2
END
========================================================================
task#3 O(n^2)
START
READ number n
number a=0
FOR i=0, i<n, i+1
FOR j=n, j>i, j-1
a=a+i+j
END
========================================================================
task#4 O(log n)
START
READ number n
numbers a=0, i=n
WHILE i>0
a=a+i
i= i/2
END
*/
}