-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.txt
More file actions
125 lines (112 loc) · 1.58 KB
/
storage.txt
File metadata and controls
125 lines (112 loc) · 1.58 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
1)
int a=-1;
output(a);
for( a=1;2;5;)
{
output(a);
}
int b;
input(b); $
2) MERGE SORT
int merge(int arr[5], int l, int m, int r)
{
int i;
int j;
int k;
int none = m - l + 1;
int ntwo = r - m;
int L[none];
int R[ntwo];
int start = 0;
int step = 1;
int end = none-1;
for (i = start;step;end;)
{
int index = l+i;
L[i] = arr[index];
}
end = ntwo-1;
for (j = start;steo;end;)
{
int index = m + 1 + j;
R[j] = arr[index];
}
i = 0;
j = 0;
k = l;
while (i < none && j < ntwo)
{
if (L[i] <= R[j])
{
arr[k] = L[i];
i = i+1;;
} ;
if(L[i] > R[j])
{
arr[k] = R[j];
j = j +1;;
} ;
k = k+1;
}
while (i < none)
{
arr[k] = L[i];
i = i+1;
k = k+1;
}
while (j < ntwo)
{
arr[k] = R[j];
j = j+1;
k = k+1;
}
return 0;
}
int mergeSort(int arr[5], int l, int r)
{
if (l < r)
{
int m = l+((r-l)/2);
int result = mergeSort(arr, l, m);
int temp = m+1;
result = mergeSort(arr, temp, r);
result = merge(arr, l, m, r);
};
return 0;
}
int arr[5];
int arrsize;
input(arrsize);
int i;
int start = 0;
int step = 1;
int end = arrsize-1;
for(i=start;step;end;)
{
input(arr[i]);
}
for(i=start;step;end;)
{
output(arr[i]);
}
int temp = arrsize-1;
int result = mergeSort(arr, 0, temp);
for(i=start;step;end;)
{
output(arr[i]);
} $
3)
4)
int a = -1;
if(a<=0)
{ output(a); }
else
{ ; }; $
5)
int i;
int start =0;
int step = 1;
int end = 3;
for(i=start;step;end;){ output(i); } $
6)
int i=0; while(i<3){ output(i); i=i+1;} $