I am a newbie to C Programming and I got some difficulty to do my C programming's task.
It's about the FIFO list.
The general info is like this:
We are required to design, implement and test two functions as specified:
1.st_priority_load( ) takes one integer and one string parameter (in that order). The string is added to a list in priority order specified by the integer parameter. The list is a data structure private to these functions.
2.st_priority_remv( ) takes a single integer reference parameter. Its action is to remove from the list the string with the highest priority value up to, and including, the value passed as its argument, and return the string so removed. The reference parameter is reset to the actual priority of the affected string. Where there are more than one string in the list with the nominated priority, the "oldest" string is to be removed and returned, i.e., each priority level behaves as a FIFO list.
1.The "highest" priority is 0, and priority m is higher than priority n if m < n.
2.The algorithmic complexity of each function must be at most O( r + s ), where
r = number of distinct priority values in list; and
s = number of strings in list with the same priority
O( r*s ) is not acceptable.
3.There are to be no predefined upper limits to the values of r or s as defined above.
4.The data structure used to represent the priority list must be hidden from the calling environment. Any suitable data structure may be used as long as it meets the preceding requirements.
I dun really get what should we do in this program.
Could anyone help me to solve this problem?