HU Structure & Set of Functions for Managing a Dictionary C Programming Exercise
Question Description
You are required to write a program for handling a dictionary. This consists of dictionary.c, which should contain
all of your function implementations, and dictionary.h, which should contain your structure denition, any necessary
typedefs, and all of your forward function declarations. When you compile, you will need to include the source le
in your command in order to ensure the functions exist during the linking process. You may include any additional
helper functions as you see t. Since you are dealing with pointers, you will need to check all of your pointers to
ensure they are not null. Trying to perform operations on null will lead to segmentation faults or other program
crashes at run-time.
The details of the dictionary functionality are described in the Maps section of this document. The bool type
referenced in this contract is found in <stdbool.h>. You are expected to do basic error checking (such as checking
for null pointers and correct index boundaries).
Your dictionary program must include the following structs (typedef-ed appropriately):
Structure Name Fields Functionality
Pair (typedef Pair) void* rst Contains the rst value of a pair (key).
void* second Contains the second value of a pair (value).
Dictionary (typedef Dictionary) BinaryTree* tree Contains the binary tree for storing your
Pairs in BinaryTreeNodes.
Your dictionary program must include the following functions:
Requirement Conditions
Function Dictionary* dict initialize(int (*)(void*, void*), void (*)(void*))
Input Parameters A function pointer to an int(void*, void*) comparison function and a function pointer
to a void(void*) print function.
Return Value The pointer to a fully initialized Dictionary.
Notes This function should create a Dictionary which is holding a fully initialized BinaryTree.
Requirement Conditions
Function bool dict insert(Dictionary*, void*, void*)
Input Parameters A pointer to a Dictionary, a void pointer to a key, and a void pointer to a value.
Return Value True if the key/value pair was successfully added to the dictionary. Otherwise false.
Notes This function should create a Pair where rst=key and second=value, then
insert it in the correct location of the underlying binary tree.
Requirement Conditions
Function void* dict get(Dictionary*, void*)
Input Parameters A pointer to a Dictionary and a void pointer to a key.
Return Value A void pointer representing the value associated with the key.
Notes This function should search through the underlying binary tree for a node which contains
the provided key and then return its associated value as a void pointer.
Requirement Conditions
Function ArrayList* dict key list(Dictionary*, int)
Input Parameters A pointer to a Dictionary and an integer representing an allocation size.
Return Value An array list where the elements stored are the keys of the dictionary in left-to-right order.
Notes Each key should be allocated an amount of space equal to the provided size integer.
Requirement Conditions
Function bool dict contains(Dictionary*, void*)
Input Parameters A pointer to a Dictionary and a void pointer to a key.
Return Value True if the key is present in the dictionary. Otherwise false.
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."