I have to get write this program asap, and have been working on it for over a week and still cannot figure it out. I am new to the language and I don't understand some of it. I know this is worth more than 75 points, but those are all I have to give. I will describe the program.
The program has to be written in C and simulate a best-fit strategy for memory allocation. It is to be done with a linked list, a starting block of 10000 free spaces of memory(0-9999). The program is supposed to use commands to allocate/deallocate blocks of this memory(it is kind of counter intuitive, the blocks represent memory not yet used, so when you allocate something, one of the block will either be made smaller or used up entirely, depending on the size the user inputs.
The data structure for the blocks(nodes) is two int variables, one for the starting address of the block and one for the ending address, and a pointer to the next node.
The allocate command asks for one variable, size, and the deallocate asks for the starting address and the size.
Now, I have been working on this night and day, writing linked list functions like deletenode, addnode, addnode in the right order, count the nodes, etc.. Thinking that I would be able to use them together to carry out this process. But I do not understand the operations that will make them all come together and do this.
My school sucks and getting help from anybody their is like getting blood from a rock. Two assistants to help 400 students. So I am hoping that someone here could help shed some light on how this would work. I have alot of basic functions written for the linked lists(they took me forever). If anyone would be so kind as to show me how to use these kind of functions to perform this process I would be very grateful.