#include #include #include typedef struct LL LL; typedef enum {MARKED, UNMARKED, UNREACHABLE} MarkingStatus; typedef struct{ size_t refer_address; size_t refee_address; MarkingStatus is_marked; bool is_used; } RefHashTableItem; size_t ref_hash_table_size = 2; size_t number_of_item = 0; RefHashTableItem *ref_hash_table; RefHashTableItem* add_item(RefHashTableItem* table, RefHashTableItem item); RefHashTableItem* delete_items(RefHashTableItem* table, RefHashTableItem item); void mark_specific(RefHashTableItem* hash_table, size_t addr); RefHashTableItem* mark(RefHashTableItem* hash_table){ for (size_t i =0; i= ref_hash_table_size){ table = resize_ref_table(table); } size_t main_addr = item.refer_address; size_t key = main_addr % ref_hash_table_size; while (table[key].is_used == true){ key = (key + 1) % ref_hash_table_size; } table[key].refer_address = item.refer_address; table[key].refee_address = item.refee_address; table[key].is_marked = item.is_marked; table[key].is_used = true; number_of_item += 1; return table; } RefHashTableItem* unreachize_item(RefHashTableItem* table, size_t addr){ size_t key = addr % ref_hash_table_size; while (table[key].refer_address != addr || table[key].refee_address != 0){ key = (key + 1) % ref_hash_table_size; } table[key].is_marked = UNREACHABLE ; return table; } RefHashTableItem* delete_items(RefHashTableItem* table, RefHashTableItem item){ for (unsigned i=0;i