921 - I2P(II)2016_Lee_Lab1 Scoreboard

Time

2016/03/04 13:50:00 2016/03/04 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10948 Delete linked list test

10948 - Delete linked list test   

Description

This problem will give you a sequence of positive integers.  Use this sequence to create a linked list to store those integers.  Next, the problem will give you another sequence of positive integers, p0, p1,…pk-1.  Delete the nodes that the data is equal to one of p0, p1, …pk-1 of the linked list, where 1<=p0<p1<…pk-1<=N. If the node is not existing,do nothing.  And show the final results.

 

 

 

 

The framework of the program is provided.

  1. Create a linked list from the input  (createList)
  2. while there are still some data pi
  3. read in pi
  4. delete node that data is equal to pi  (deleteNode)
  5. print the remaining list (printList)
  6. free the list (freeList)

You will be provided with main.c and function.h. main.c contains the implementation of function printList, and freeList, and function.h contains the definition of node and the interface of createList() and deleteNode(&head, pi).  You only need to implement createList() and deleteNode(&head, pi) in function.c, in which head is the head of the linked list, and pi is the data of the node to be deleted.

 

For OJ submission, you only need to submit your createList and deleteNode implementation to the submission block. (Choose c compiler) 

 

Below is the partial code for main.c

main.c

 

function.h

Input

The input contains 2 sequences of positive integers.  The first sequence is to create a linked list of integers, and the second sequence is the nodes to be deleted.  Each sequence is ended by -1. 

Output

The output contains the sequence of resulting linklist.

Sample Input  Download

Sample Output  Download

Partial Judge Code

10948.c

Partial Judge Header

10948.h

Tags

contest 10402Contest



Discuss