Create a new file named linked_list_tests.c
with a corresponding header file. This file should contain three functions:
void linked_list_insert_sequential_start(int num_samples, int sample_size)
void linked_list_insert_sequential_end(int num_samples, int sample_size)
void linked_list_insert_random(int num_samples, int sample_size)
The first test should create a new sample of size sample_size
. Similar to the testing functions used for arrays, you can simulate this using a void *
object and allocating sample_size
bytes to it. Insert the new pointer at the beginning of the linked list.
The second test will be almost identical to the first one you created, except you should add each sample to the end of the list. Since you are simulating a standard, singly-linked list, you should expect that this version will perform slower inserting at the beginning of the list.
The third and final test should insert the samples at a random position based on the current number of samples. Reference the random tests in array_tests.c
to see how the random values are generated.
After implementing all three functions, include the header file in run_tests.c
and create a function named void linked_list_tests(int num_samples, int sample_size)
. This function should call each individual test you created previously. Use array_tests
as a reference to what this should look like.
The provided Makefile
will compile and run the tests automatically. If you implement the functions as requested correctly, this will also work for your new tests. Once you have implemented the new tests, run the test by calling make
.
The output should clearly show which test is being performed followed by the time (in ms) that it took to execute the test. Feel free to model your benchmark function after the array tests already provided. If the tests run properly, you’re done!
Choose an academic level, add pages, and the paper type you want.
To reduce the cost of our essay writing services, select the lengthier deadline.
We can't believe we just said that to you.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments