Please write the entire C code for this. For this assignment, you will be writing your own memory allocator. Writing a custom memory allocator is something you might do if you work on performance sensitive systems
(games, graphics, quantitative finance, embedded devices or any application you want to run fast!). Malloc and free are general purpose functions written to manage memory in the average use case quite well, but they can always be optimized for a given workload. That said, a lot of smart people have worked on making malloc / free quite performant over a wide range of workloads. Optimization aside, you might write an allocator to add in debugging features, and swap it in as needed