当前位置:天才代写 > CS代写,CS作业代写考试代考-价格便宜有靠谱 > 北美计算机代写 computer science代写

北美计算机代写 computer science代写

2022-11-05 09:38 星期六 所属: CS代写,CS作业代写考试代考-价格便宜有靠谱 浏览:354

北美计算机代写

Homework 06 – Singly Linked List and malloc/free Interposition

北美计算机代写 When we test your code, we will only copy over your Makefile and list.c file to see if it works with the rest of the program provided to you.

Due Wednesday 10/24/2018 11:59pm

What to get before you start

Download hw6handout.tar file from Canvas. It will include the following files.

hw6handout/list.c

hw6handout/list.h

hw6handout/main.c

hw6handout/Makefile

hw6handout/mymalloc.c

What to do  北美计算机代写

1.Modify Makefile, so that besides the ./main program your Makefile will also create ./mainlink program that uses link time interposition method to overwrite library function calls to malloc and free. When you run the program ./mainlink, every function call to malloc or free in the program will print out a trace. Review slides and code from Chapter 7 (week07.tar) for details. The link time interposition uses the linker’s –wrap option to resolve any calls to malloc now to __wrap_malloc and resolve any calls to __real_malloc to the actually malloc call in the library.

2.The main body of the list implementation is already implemented for you, which includes push/pop/display/destroy and the engine to manipulate a list. All you need to do is to Implement the following four functions in list.c file.  北美计算机代写

a.int count(listNode *listPtr, int value);

b.void insert(listNode **listPtr, int value);

c.void reverse(listNode **listPtr);

d.void removeAll(listNode **listPtr, int value);

Here is some details about each function’s implementation.

a.int count(listNode *listPtr, int value);

Count how many times the value appeared in the list. This function should not need to allocate or free any memory.

b.void insert(listNode **listPtr, int value);

北美计算机代写
北美计算机代写

Add a new node with value to the TAIL of the list.  北美计算机代写

This function should call malloc exactly once. If the original list was empty, remember to update the head pointer stored in location pointed to by listPtr.

c.void reverse(listNode **listPtr);

Reverse the order of all nodes in the list. Do not allocate or free any memory space for this function. You should be able to reverse the list simply by relinking/rearranging the existing allocated nodes.

d.void removeAll(listNode **listPtr, int value);

Remove all nodes that has the given value in the list and free the memory spacefor those nodes. Please make sure that after removing the value, the remaining list is still properly linked together. Also watch out for the corner cases of the value is at the head or tail of the list.  北美计算机代写

More details about suggested traces of execution to test your code will be posted on Piazza.

Please make sure you get notification from Piazza properly.

You will only need to make changes to Makefile and list.c file. DO NOT Modify any other files in the handout folder or add or remove any files or change any files’ names in the folder. When we test your code, we will only copy over your Makefile and list.c file to see if it works with the rest of the program provided to you.

What to submit

Submit a tar file hw6handout.tar that contains the same set of files as hw6handout.tar you initially get, with only list.c/Makefile modified to complete the homework.

 

北美计算机代写
北美计算机代写
更多代写:北美高校代网课  proctorio作弊  北美经济专业网课代修  北美网课代上  北美作业代做  论文内容

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式