#ifndef __VECTOR_H__ #define __VECTOR_H__ typedef struct { int *arr; int max_size; int cur_size; } vector_t; vector_t vector_init(int size); // initialize vector with a initial capacity of size int size(vector_t vec); // returns the number of elements in vector int capacity(vector_t vec); // returns the capacity of vector int is_empty(vector_t vec); // return true if vector is empty, false if not int at(vector_t vec, int index); // returns the element at index void push(vector_t *vec, int value); // add element to end of vector void insert(vector_t *vec, int index, int val); // add element at index and pushing other elements to right void delete_vec(vector_t *vec, int index); // delete element at index, move other elements to left void remove_val(vector_t *vec, int value); // remove all instance of value in vector void prepend(vector_t *vec, int value); // add element at front of vector int pop(vector_t *vec); // remove element at end, return value of element void print_vec(vector_t vec); // printf the vector in [1, 2 ] format void destroy_vec(vector_t *vec); // deallocates the vector int find_vec(vector_t vec, int value); // find first occurance of value in vector // return -1 if not found void resize_vec_check(vector_t *vec); // checks if vector capacity needs to be doubled or halves // if cur_size == max_size, will double // if cur_size <= max_size/4, will half void resize_vec(vector_t *vec, int new_capacity); // resizes the vector given the new_capacity // sets max_size to new_capacity #endif