Create a new file named linked_list_tests.c with a corresponding header

 

Create a new file named linked_list_tests.c with a corresponding header file. This file should contain three functions:

  1. void linked_list_insert_sequential_start(int num_samples, int sample_size)
  2. void linked_list_insert_sequential_end(int num_samples, int sample_size)
  3. void linked_list_insert_random(int num_samples, int sample_size)

Sequential Insert

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.

Random Insert

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.

Running the Tests

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!

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

FINAL SECTIONS TO BE ATTACHED Reference page: This must be

FINAL SECTIONS TO BE ATTACHED Reference page: This must be a part of the report, and not a separate document. You should have at least five references, and your references must be cited in your report. Center the heading Works Cited. Do not type the word Page. Place your Works

Do you take any vitamins or dietary supplements? Do you

Do you take any vitamins or dietary supplements?  Do you think vitamins and minerals can make up for a poor diet?  Who should take vitamins and supplements?  How are vitamins and supplements regulated?  What are some safety considerations to consider when taking supplements? Here is a resource from the CDC

Select two underdeveloped countries and examine the key Nursing Assignment Help

Select two underdeveloped countries and examine the key determinants of health. Compare and contrast the healthcare systems, economy, and healthcare system challenges, such as access to care and health disparities. Use the Eight Factor Model to assess the strengths and weaknesses of the healthcare systems and determine the extent to

Information systems

You work for a hospital in the registration and admissions department, and most of your tasks are performed manually. For example, when an individual checks in, you must obtain personal information, details on an individual’s medical background, and hospitalization insurance. You are a strong advocate for information technology and have

Assignment 5.1: Grand Nursing Theory

1-Select one theorist from the following list: Faye Abdellah, Florence Nightingale, Betty Neuman, Dorothea Orem, Martha Rogers, Rosemarie Parse, Jean Watson. 2-It will be assessed on these elements: Biographical information and origin of theory Description of theory with concepts Evaluation of theory Application of theory in research/practice/education Creativity and effectiveness

Upon your recent travels to the China/Japan area for Religious

Upon your recent travels to the China/Japan area for Religious News, you came across the following article that seemed like major news: Holtz, M. (2016, January 20). Japanese prime minister, party leaders seek policies that revive Shinto religion. Christian Century, 133(2), 16. https://libraryresources.columbiasouthern.edu/login?url=https://search.ebscohost.com/login.aspx?direct=true&db=asn&AN=112343000&site=ehost-live&scope=site As an up-and-coming reporter, you felt it

Question 1: How do the surface temperatures of the countries

  Question 1: How do the surface temperatures of the countries in the northern latitudes (for example, Canada, Iceland, Norway, and Russia) compare to those of northern Africa (for example, Algeria, Egypt, Libya, Morocco, and Sudan)?Question 1 options: 1)  The temperatures are higher in the northern latitudes during summer months

This week select an organization that has a Global platform

 This week select an organization that has a Global platform (they operate in more than one country), that has demonstrated operational excellence.  In this paper, perform the following activities: Name the organization and briefly describe what good or service they sell and where they operate. Note how they are a

Being in a digital world, most of us use social

   Being  in a digital world, most of us use social media in one way or another.   Your favorite form of social media and why. Your least favorite form of social media and why. In your own experience, what kind of impact you think social media has on our

This discussion is based on a story of an 18-month

This discussion is based on a story of an 18-month old named Josie King that lost her life because of a medical error. Josie’s mother used the settlement money to create the Josie King Foundation to help reduce the mortality rate by encouraging hospitals to adopt patient-safety programs. Instructions: Read

Case Study – Just War Theory: Then and Now

Just War Theory was created centuries ago to create moral guidelines for nation-states and leaders to determine when the use of war is justified in pursuit of a nation’s interests. Recently, the U.S. pursued a preemptive war in Iraq based on the alleged Iraqi acquisition of Weapons of Mass Destruction.

Please do a PowerPoint slides of your research paper presentation

  Please do a PowerPoint slides of your research paper presentation . Use the content from your project report (and external research if required) to prepare slides. Time your presentation to end in 12 to 15 minutes while covering all the slides. You may use Microsoft power point software to

Read all pages carefully, selected topic, intro & must be

Read all pages carefully, selected topic, intro & must be follow format according to Sample Paper (3-3 Para each Article)           Must be 100% Original           I hv already attached Articles, u must be use this 3 articles for Annotated Bibliography  Instructor Comment on last work:

Opposing the right to be forgotten

For this week’s writing assignment, you will answer a reflection question: Should we have the “right to be forgotten”? And, if so, should it be Google’s responsibility? Some will take a side favoring the right to be forgotten, while remaining group members will take a side opposing it. THE PAPER SHOULD OPPOSE

Organizational plan for a Christian Healthcare Organization

Management and leadership are an integral part of any organization, especially healthcare organizations. In the context of a Christian healthcare provider describe a fictional Christian healthcare organization you’re attempting to open and obtain funding for. The organizational plan should include and describe the following: The physical location where services will