12983 - Implement Set Using Linked List II   

Description

Please use the provided two files, main.c and function.h, to implement a set. Includes following functions:

  1. Insert N: insert an element which value is N into a set.
  2. Erase N: remove the element which value is N from a set.
  3. Check N: check if the element which value is N is inside a set.
  4. Traversal: traversal the set.

Note:

  1. A Set data structure shold never have a same element inside.
  2. Elements inside a set should be arranged from large to small.

Go download function.c, and only need to submit function.c.

Input

Legal commands:

  1. “insert N”: Insert an element which value is N into the set.
  2. “erase N”: Remove the element which value is N and return its pointer. Remove nothing is there is no element which value is N.
  3. “check N”: Check if the element which value is N is inside a set. Print “true\n” if it’s inside, print “false\n” if it’s not.
  4. “print”: Traversal the set, and print every element in ordered. Print “Set is empty\n” if set is empty.

Output

No need to handle output. Please use function.c above.

Sample Input  Download

Sample Output  Download

Partial Judge Code

12983.c

Partial Judge Header

12983.h

Tags




Discuss