Algorithms/test.c

53 lines
1.0 KiB
C
Raw Permalink Normal View History

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define STACK_TYPE double
#include "source/handystack.h"
#define LIST_TYPE float
#include "source/handylist.h"
2017-10-02 10:40:39 +00:00
#define QUEUE_TYPE int
#include "source/handyqueue.h"
#define TREE_TYPE char
#include "source/handytree.h"
void printList(float_list* list){
int size = size_float_list(list);
for (int i = 0; i < size; i++){
printf("\tIndex: %d, Value: %f\n", i, get_float_list(i, list));
}
for (int i = 0; i < 20; i++){
printf("-");
}
printf("\n");
}
2017-10-02 10:40:39 +00:00
void printQueue(int_queue q){
for (int i = q.front; i < q.back; i++){
printf("\t%d. %d\n", i, q.data[i]);
}
}
int main(int argc, char* argv[]){
double_stack s = new_double_stack();
push_double_stack(42.5, &s);
print_double_stack(s);
2017-10-02 10:40:39 +00:00
free_double_stack(s);
2017-10-02 10:40:39 +00:00
int_queue q = new_int_queue();
for (int i = 2; i < 20000000; i *= 2){
enqueue_int_queue(&q, i);
2017-05-23 19:25:31 +00:00
}
2017-10-02 10:40:39 +00:00
print_int_queue(q);
printf("First Item in queue: %d\n", dequeue_int_queue(&q));
free_int_queue(q);
char_tree_node root = new_char_tree_node('a', 0);
}