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!
We are a professional custom writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework.
Yes. We have posted over our previous orders to display our experience. Since we have done this question before, we can also do it for you. To make sure we do it perfectly, please fill our Order Form. Filling the order form correctly will assist our team in referencing, specifications and future communication.
1. Click on the “Place order tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
2. Fill in your paper’s requirements in the "PAPER INFORMATION" section and click “PRICE CALCULATION” at the bottom to calculate your order price.
3. Fill in your paper’s academic level, deadline and the required number of pages from the drop-down menus.
4. Click “FINAL STEP” to enter your registration details and get an account with us for record keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
5. From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.
Need help with this assignment?
Order it here claim 25% discount
Discount Code: SAVE25