Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC215 Homework Homework 11 Due date: Dec 19, 2016.

Similar presentations


Presentation on theme: "CSC215 Homework Homework 11 Due date: Dec 19, 2016."— Presentation transcript:

1 CSC215 Homework Homework 11 Due date: Dec 19, 2016

2 Question 1 : implement the function remove_nth that is declared with the prototype given below.
void* remove_nth(LinkedList* ll, int n); /* corrected! */ removes the node at position n (head is at position 0) and returns the data stored in it if possible, or NULL otherwise. Node and LinkedList are defined as follows: typedef struct Node Node; Node* new_node(void*); typedef struct LinkedList LinkedList; struct Node{ void* data; Node* next; }; struct LinkedList { Node* head; };

3 Question 2 : Stack S1 is empty, and Stack S2 is not
Question 2 : Stack S1 is empty, and Stack S2 is not. Write the statements required to copy elements of S2 to S1 in the same order. The following are defined already: typedef struct Stack Stack; Stack* new_stack(); void* pop(Stack* s); void push(Stack* s, void* data); typedef struct Queue Queue; Stack* new_queue(); void* serve(Queue* q); void enqueue(Queue* q, void* data); You do not need to redefine any of them.


Download ppt "CSC215 Homework Homework 11 Due date: Dec 19, 2016."

Similar presentations


Ads by Google