tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
22
Task/Queue-Definition/C/queue-definition-3.c
Normal file
22
Task/Queue-Definition/C/queue-definition-3.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
int main()
|
||||
{
|
||||
int i, n;
|
||||
queue q = q_new();
|
||||
|
||||
for (i = 0; i < 100000000; i++) {
|
||||
n = rand();
|
||||
if (n > RAND_MAX / 2) {
|
||||
// printf("+ %d\n", n);
|
||||
enqueue(q, n);
|
||||
} else {
|
||||
if (!dequeue(q, &n)) {
|
||||
// printf("empty\n");
|
||||
continue;
|
||||
}
|
||||
// printf("- %d\n", n);
|
||||
}
|
||||
}
|
||||
while (dequeue(q, &n));// printf("- %d\n", n);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue