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

Which nonhistone protein helps to maintain chromosome structure? a.- Premium Paper Help

Q1: Which nonhistone protein helps to maintain chromosome structure? a.- Nucleosome. b.- Chromatin. c.- Actin. d.- Scaffolding protein. Q2: Please explain the cytokinesis. Q3: Typical somatic cells in animals include: a.- 2n cells. b.- Sperm cells. c.- n cells d.- All Gamete cells. Q4: What are 3 reasons to explain genetic variations in Meiosis? ________________ Q5: If

To begin, media, or other scholarly sources to identify and

To begin, media, or other scholarly sources to identify and select a contemporary article that describes an organization with a performance issue. You may also use an organization with which you are personally familiar. Prepare a gap analysis that includes a description of your findings and recommendations, along with the

This discussion is for you to gain more information about

This discussion is for you to gain more information about possible social work professional positions and to further your exploration of social work as a career. For this week’s reading section in Grobman’s More Days in the Lives of Social Workers: 62 Professionals Tell “Real-Life” Stories From Social Work Practice, please

Peer 1 Sophie Question #2: What are the effects of

Peer 1 Sophie  Question #2: What are the effects of pluralism? Why might groups concerned with the environment, women’s issues, or other concerns have an easier time being heard in a pluralist system? What other issue advocates (if any) might become prominent in Europe in coming years? Why? Pluralism is

In at least 600 words, analyze the song’s lyrics and

  In at least 600 words, analyze the song’s lyrics and images to help the reader make the connection between the song and the need for civic engagement. Use the assigned course reading materials to support your argument. You can choose your music video or select one of these. Video:  Black

The privacy of personal information and of health information in

 The privacy of personal information and of health information in particular, continues to be a dynamic issue in the United States. As more and more health information is computerized, healthcare consumers express concern about their privacy and that they are losing control over their personal health information. Click here to access the section

Character Psychological Conceptualization Paper: Nina Sayer from Black

The paper is for a counseling psychology class. It is about the character Nina Sayer (Natalie Portman) in Black Swan. There should be 4 sections in the paper: 1) Summary of important events in the character’s life. 2) Summary of a psychological theoretical orientation (psychodynamic; cognitive-behavioral; ecological perspective). 3) Conceptualization

Discussion 4 Week 4 Discussion Choose 1 of the following

  Discussion 4 Week 4 Discussion Choose 1 of the following questions to answer by day 3 (Wednesday) and include 2 references. Your post should be at least 250 words. Please remember to answer to 2 of your classmates’ discussions (on 2 separate days) by Saturday.  The reply to your

Week 5 Assignment – Miranda Rule or Exception? Overview Prior

  Week 5 Assignment – Miranda Rule or Exception? Overview    Prior to the Miranda v Arizona ruling in 1966, law enforcement could question possible suspects without their having legal counsel present. They could bully potential suspects, trick them, and do whatever else they thought was necessary to determine potential suspects’ involvement

write 400–600 words that respond to the following questions with

  write 400–600 words that respond to the following questions with your thoughts, ideas, and comments. This will be the foundation for future discussions by your classmates. Be substantive and clear, and use examples to reinforce your ideas. Consideration of workforce diversity is a part of human resource management (HRM).

SMUM Demographics and Determinants of Health Discussion Nursing Assignment Help

Expert Solution Preview Introduction: As a medical professor responsible for creating assignments and evaluating student performance in a medical college, it is crucial to provide effective feedback and assessments that facilitate the students’ learning and growth. By designing lectures and examinations, I aim to enhance their understanding of medical concepts,

Weekly Article Summary 4 Find and read a nursing scholarly

  Weekly Article Summary 4 Find and read a nursing scholarly article that relates to your clinical practice and is found in a peer-reviewed journal. Follow the instructions for the format and write a 1-page summary. Submission Instructions: Must be a research article. Write a 1-page summary using an outline

DEAL OF THE CENTURY can you do the excel model?

  DEAL OF THE CENTURY can you do the excel model? To calculate the cash flow/income approach related case study New York City of 1978 is a bad place where crime rates are high, and business have spent the last 10 years fleeing to the surrounding suburban areas. Based on

CSU statistical presentation Nursing Assignment Help

Using the final project rubric attached for the specific grading criteria, complete part 1 and part 2 separately following the HINT215 Final project attached. Expert Solution Preview Introduction: As a medical professor responsible for designing college assignments and evaluating student performance, I aim to provide a comprehensive and stimulating learning

For this topic in your initial post (300-500 words) summarize

For this topic in your initial post (300-500 words)  summarize how the respective political economic perspective perceives one of the policy issues (chosen from one of the policy Chapters 13-15-be clear about which chapter you are using), in terms of proper role of government, actual role of government, and proposals for reform.

Reflection 2: Do you think more or less discretion is

Reflection 2: Do you think more or less discretion is needed within the criminal justice system (specifically policing and courts, but can also include corrections)?  Similar to Reflection 1, be sure to briefly state the opposing point of view and then why your opinion is more accurate.  Additionally, be sure