Implementation of a Linked List
Linked List作業代寫、代做C/C++課程設計作業、代寫C/C++實驗作業、代做Memory Management作業
Assignment #4 - Memory Management in C:
Implementation of a Linked List
Assignment Description: In this assignment, you will build a program that dynamically manages memory on the heap. Specifically, you will read student information from a file, populate each student as a record in a linked list, and clean up heap memory before terminating.
Learning Objectives: This assignment connects to the following course goals:
●Course Goal #5: Improve problem-solving and programming competency by building ever complex programs, specifically through analyzing, designing, implementing, testing and debugging C programs using various data types, loops, branches, arrays, and structs.
●Course Goal #6: Write programs that manage memory using dynamic memory allocation functions and variables that contain a memory address (pointers). Apply these skills to allocate memory at run-time, and to (a) increase performance by passing addresses to functions instead of copying data, and (b) return more than one value from a function.
Starter Code: The following files are provided for you in this tarball
●students.h : Defines a student structure and function prototypes
●students.c : Functions are defined in this file, but not implemented
●test.data : Contains some sample test data
●Makefile : For compiling the program
YOUR TASK is to implement the following functions (found in student.h header file):
●Student *buildStudentList()
○Creates the entire linked list from the file. Should call readNext and push functions. Return is the head of the linked list
●Student *makeStudent(char name[16], int age, double gpa);
○Creates a student structure on the heap based on input parameters
●Student *readNext();
○Reads the next line from standard input and creates a student structure on the heap
●void push(Student *student);
○Pushes a new student node to the head of the linked list
●void insert(Student *list, Student *s, int position);
○Inserts a new student node in a specific position in the linked list
●DisplayAll()
○Displays the entire contents of the linked list
●CleanUp()
○Frees all memory that remains on the heap before the program terminates
Be Careful! The purpose of this assignment is to make sure you know how to dynamically manage memory and use pointers appropriately. Therefore….
●Do not edit the main method (except for testing)
●Do not change the function prototypes to get your code to work.
●Do not create any new global variables
Test Cases: If you implemented your assignment correctly, you should get the following results. Make sure that you are not violating the conditions above when testing your assignment. We will be checking your code and ensure that it is following those rules when grading.
Submission Details:
●Double check that your code works before submitting. You will only be a submit your code on blackboard once
●Store the students.c, students.h, test.data, and Makefile files in a single tarball named yourNetID_hw4.tar (your netID should be in the following format: ab123123)
Grading Rubric:
Component Weight
Properly Submitted: All the submission instructions (documented above) were followed properly 10 points
Commenting & Programming Organization: Code is well organized and properly commented. Your code should be easy to read and follow. It should not be overly complicated / convoluted. 10 points
Functionality - buildStudentList subroutine: Creates the entire linked list. 20 points
Functionality - makeStudent subroutine: Successfully able to create a student structure based on input values 10 points
Functionality - readNext subroutine: Successfully reads a line from standard input and creates a student structure on the heap 10 points
Functionality - push subroutine: Successfully inserts a student structure at the head of the linked list 10 points
Functionality - insert subroutine: Inserts a student node in a specific position within the linked list 10 points
Functionality - DisplayAll subroutine: Dumps the entire contents of the linked list to the screen (standard output) 10 points
Functionality - CleanUp subroutine: Frees all memory that remains on the heap before the program terminates. Full points are only allocated if no memory leaks have occured. 10 points
*NOTE: Your code must compile to receive a grade. Code that does not compile will receive a grade of a zero.
http://www.6daixie.com/contents/13/2336.html
WARNING! All student submissions will be scanned for similarity. You may help each other, but sharing code is considered cheating. Additional details are below. Ask questions, if you are confused.
●Permissible Collaboration: (1) Working together to understand the homework, (2) Helping a fellow student with a bug, (3) Working together to design a solution (for example: flowchart diagram and/or pseudo-code)
Cheating / Academic Dishonesty: (1) Sharing your code with another student, (2) Copying code segments from another student, (3) Having significantly similar code as another student, and (4) Students that have portions of their code similar to online sites such as Chegg or StackOverflow will be reported for academic dishonesty!
因為專業,所以值得信賴。如有需要,請加QQ:99515681 或郵箱:[email protected]
微信:codinghelp