Question: Data Structure and algorithms in C This program will take assignments . Daily-Quiz 3 to Daily Quiz 6, and combine their behaviors to make an

Data Structure and algorithms in C  Data Structure and algorithms in C This program will take assignments
. Daily-Quiz 3 to Daily Quiz 6, and combine their behaviors to
make an opaque object wrapper that allows for all the behaviors we

This program will take assignments . Daily-Quiz 3 to Daily Quiz 6, and combine their behaviors to make an opaque object wrapper that allows for all the behaviors we want in a bit collection data structure called BIT FLAGS #1fndef BITFLAGSH adefine BIT FLAGS H include status.h - - typedef void BIT FLAGS //Intentionally leaving out a default init function to force user to at least guess at the size needed. /If one WERE to be used it would have the following prototype BIT FLAGS bit flags init default(void); //Precondition: number of bits is a positive integer //Postcondition: Returns the handle to a valid Bit flags object that has the abiiity to store up to number of bits bits but currently all flags are set at zero. Returns NULL on failure. The container is assumed to hold sizesnumber of bits after the init function runs BIT FLAGs bst flags init_umber of bits(int number of bits): //Precondition: flag position is a non-negative integer and hBit flags is a handle to a valid Bit flags object //Postcondition: The flag at the flag position index is set to 1. Function wi1l attempt to resize the internal representation if the flag position is too large instead of failing for out of bounds. Returns // SUCCESS if the operation is successful and FAILURE if the operation failsneeded resize. This operation is cons idered to be expensive 1f flag position is constantly going out of bounds by a smal1 amount because the resize always attempts to mininize the amount of space required to store the bits All new flags created in a resize operation (except the one being set) wi11 be set as zero. Status bit flags set flag(BIT FLAGS hBit flags, int flag position) //Preconditiom: flag position is a non-negative integer and h8it flags is a handle to a valid Bit flags object //Postcondition: The flag at the flag position index is set to e. Function will attempt to resize the internal representation if the flag position is too large instead of failing for out of bounds. Returns // SUCCESS if the operation is successful and FAILURE if the operation fails a needed resize This operation is considered to be expensive if flag position is constantly going out of bounds by a small anount because the resize always attepts to mininize the anount of space required to store the bits A11 new flags created in a resize operation w111 be set as zero Status bit flags unset flag(BIT FLAGs hBit, flags, int flag position) //Precondition: flag positlon is a non-negative integer and hBit flags is a handle to a valid Bit flags object //Postcondition: returns the value of the flag at index flag position if it is in bounds or -1 otherwise int bit flags_check flag(IT FLAGS hBit flags, int flag position) //Precondition: Bit flags is a handle to a valid Bit flags object //Postcondition: returns the number of bits currently held by the data structure. int bit flags get size(BIT FLAGS hBit flags) //Precondition: h8it fFlags is a handle to a valid Bit flags object. //Postcondition: returns the number of bits the object CAN hold int bit flags get capacity(8IT FLAGS hBit_flags) /Precondition: ph8it flags is the address of a handle to a valld Bit flags object //Postcondit ion: The memory for the object referred to by the handle is free'd and the handle is set to NULL void bit flags destroy(BIT FLAGS phBit flags) endif Turn in only your bit flags.h and bit flags.c files for grading. The graders will use their own main program to test your data structure but you should test it as well as you can yourself with your own driver. The graders will also assume you are using the status.h we created in class. Please note that you may not change prototype of any of these functions as the functions must work with our driver you can only use these In the comments section of your code think about your data structure and what might be missing Come up with one proposed function that you could add to the interface (you do not have to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!