derniere maj du td3 de C pour le rendu en zip
This commit is contained in:
BIN
tp3/TP3.tgz
BIN
tp3/TP3.tgz
Binary file not shown.
@@ -1 +0,0 @@
|
||||
alloc.o: alloc.c alloc.h error.h
|
||||
BIN
tp3/TP3/alloc.o
BIN
tp3/TP3/alloc.o
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
main.o: main.c alloc.h error.h queuetest.h queue.h stacktest.h stack.h \
|
||||
testprint.h
|
||||
BIN
tp3/TP3/main.o
BIN
tp3/TP3/main.o
Binary file not shown.
@@ -101,7 +101,6 @@ void enqueue(int val, queue *p) {
|
||||
}
|
||||
|
||||
int dequeue(queue *p) {
|
||||
// print_queue(p);
|
||||
if (isempty_queue(p)) {
|
||||
FATAL("Pop on empty queue");
|
||||
}
|
||||
@@ -119,7 +118,6 @@ int dequeue(queue *p) {
|
||||
p -> right = 0;
|
||||
return val;
|
||||
}
|
||||
// printf("left = %d, right = %d size = %d\n", p -> left, p -> right, getsize_queue(p));
|
||||
if (p -> left == p -> right + 1) {
|
||||
p -> empty = true;
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
queue.o: queue.c queue.h alloc.h error.h testprint.h stack.h
|
||||
BIN
tp3/TP3/queue.o
BIN
tp3/TP3/queue.o
Binary file not shown.
@@ -9,7 +9,6 @@ queue *random_queue(int size, int maxval) {
|
||||
queue* p = create_queue();
|
||||
for (int i = 0; i < size; i++) {
|
||||
enqueue(rand() % maxval, p);
|
||||
// print_queue(p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
@@ -17,13 +16,9 @@ queue *random_queue(int size, int maxval) {
|
||||
queue *copy_queue(queue *p) {
|
||||
queue* p_out = create_queue();
|
||||
for (int i = 0; i < getsize_queue(p); i++) {
|
||||
// printf("left: %d right: %d size: %d\n", p -> left, p -> right, p -> size_array);
|
||||
int val = dequeue(p);
|
||||
// printf("val: %d\n", val);
|
||||
enqueue(val, p);
|
||||
enqueue(val, p_out);
|
||||
// print_queue(p);
|
||||
// print_queue(p_out);
|
||||
}
|
||||
return p_out;
|
||||
}
|
||||
@@ -32,7 +27,6 @@ queue *mountain_queue(int n) {
|
||||
queue* p = create_queue();
|
||||
for (int i = 0; i < n; i++) {
|
||||
enqueue(n - i, p);
|
||||
// print_queue(p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
queuetest.o: queuetest.c queuetest.h queue.h alloc.h error.h testprint.h \
|
||||
stack.h
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
stack.o: stack.c stack.h alloc.h error.h
|
||||
BIN
tp3/TP3/stack.o
BIN
tp3/TP3/stack.o
Binary file not shown.
Binary file not shown.
@@ -45,7 +45,6 @@ void hanoi(int n) {
|
||||
int max = n;
|
||||
int *count = 0;
|
||||
hanoi_rec(p1, p2, p3, p1, p2, p3, n, max, count);
|
||||
print_stacks(max, 3, p1, p2, p3);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,11 +52,9 @@ void hanoi_rec(stack *p1, stack *p2, stack *p3,
|
||||
stack *q1, stack *q2, stack *q3,
|
||||
int n, int max, int *count) {
|
||||
if (n == 0) {
|
||||
// print_stacks(max, 3, q1, q2, q3);
|
||||
return;
|
||||
};
|
||||
hanoi_rec(p1, p3, p2, q1, q2, q3, n-1, max, count);
|
||||
print_stacks(max, 3, q1, q2, q3);
|
||||
push(pop(p1), p3);
|
||||
hanoi_rec(p2, p1, p3, q1, q2, q3, n-1, max, count);
|
||||
return;
|
||||
@@ -70,7 +67,6 @@ void bubble_sort_stack(stack *p) {
|
||||
for (int j = 0; j < n - 1; j++) {
|
||||
push(pop(p), p_aux);
|
||||
}
|
||||
print_stacks(n - i, 2, p, p_aux);
|
||||
for (int j = i; j < n - 1; j++) {
|
||||
int a = pop(p);
|
||||
int b = pop(p_aux);
|
||||
@@ -85,7 +81,6 @@ void bubble_sort_stack(stack *p) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
push(pop(p_aux), p);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
delete_stack(p_aux);
|
||||
return;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
stacktest.o: stacktest.c stacktest.h stack.h alloc.h error.h testprint.h \
|
||||
queue.h
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
testprint.o: testprint.c testprint.h alloc.h error.h queue.h stack.h
|
||||
Binary file not shown.
Reference in New Issue
Block a user