| Schedule | |||
|---|---|---|---|
| 07:00 | Wake up. | YES | |
| 07:00 | 07:30 |
Morning activities
1 Coffee, 1 cigarette |
YES |
| 07:30 | 09:00 |
Preparatory works
1 coffees, 1 cigarettes |
YES |
| 09:00 | 10:30 |
Daily activity
1 cigarette |
YES |
| 10:30 | 11:00 | Breakfast | YES |
| 11:00 | 14:00 | Daily activity | YES |
| 14:00 | 14:30 | Dinner | YES |
| 14:30 | 16:00 | Daily activity |
Didn't smoke
Sequence changed All OK But I didn't have time to find a bug in the C implementation. |
| 16:00 | 17:30 |
Exercise module 5 "Crash Course on Python"
1 cigarette |
|
| 17:30 | 19:00 |
Bubble sorting on Python and C
1 cigarette |
|
| 19:00 | 20:30 |
Supper
Watch the TV series |
|
| 20:30 | 21:30 | Free time | |
| 21:30 | 22:00 | Evening activities | YES |
| 22:00 | 23:00 | Read my book | YES |
| 23:00 | 07:00 | Sleep | YES |
m=True # Ascendance
ar=[8,2,0,9,1,4,7,5,3,6]
n=len(ar)
for i in range(n-1):
done=True
for j in range(n-i-1):
if m ^ (ar[j]<ar[j+1]):
(ar[j],ar[j+1])=(ar[j+1],ar[j])
done=False
if done:
break
print(ar)
#include <stdio.h>
#include <stdbool.h>
int main(){
bool m=false; //Ascendance
int ar[]={3,6,2,0,7,1,4,9,5,8};
int n=sizeof(ar)/sizeof(ar[0]);
bool done;
for (int i=0;i<n-1;i++){
done=true;
for (int j=0;j<n-i-1;j++){
if (m ^ (ar[j]<ar[j+1])){
int t=ar[j];
ar[j]=ar[j+1];
ar[j+1]=t;
done=false;
}
}
if (done){
break;
}
}
for (int i=0;i<n;i++){
printf("%d ",ar[i]);
}
return 0;
}