2017-05-22 13:26:21 +00:00
|
|
|
#include <stdio.h>
|
2017-05-23 08:45:31 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
2017-05-22 13:26:21 +00:00
|
|
|
|
2017-05-23 19:11:35 +00:00
|
|
|
#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"
|
|
|
|
|
2017-10-02 11:17:08 +00:00
|
|
|
#define TREE_TYPE char
|
|
|
|
#include "source/handytree.h"
|
|
|
|
|
2017-05-23 19:11:35 +00:00
|
|
|
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]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-22 13:26:21 +00:00
|
|
|
int main(int argc, char* argv[]){
|
2017-05-23 08:45:31 +00:00
|
|
|
|
2017-05-23 19:11:35 +00:00
|
|
|
|
2017-05-23 08:45:31 +00:00
|
|
|
double_stack s = new_double_stack();
|
2017-05-23 16:02:10 +00:00
|
|
|
push_double_stack(42.5, &s);
|
2017-05-23 08:45:31 +00:00
|
|
|
print_double_stack(s);
|
2017-10-02 10:40:39 +00:00
|
|
|
free_double_stack(s);
|
2017-05-23 08:45:31 +00:00
|
|
|
|
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);
|
2017-05-23 16:02:10 +00:00
|
|
|
|
2017-10-02 11:17:08 +00:00
|
|
|
char_tree_node root = new_char_tree_node('a', 0);
|
|
|
|
|
2017-05-22 13:26:21 +00:00
|
|
|
}
|