12983 - Implement Set Using Linked List II
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description
Please use the provided two files, main.c and function.h, to implement a set. Includes following functions:
- Insert N: insert an element which value is N into a set.
- Erase N: remove the element which value is N from a set.
- Check N: check if the element which value is N is inside a set.
- Traversal: traversal the set.
Note:
- A Set data structure shold never have a same element inside.
- 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:
- “insert N”: Insert an element which value is N into the set.
- “erase N”: Remove the element which value is N and return its pointer. Remove nothing is there is no element which value is N.
- “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.
- “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.
Partial Judge Code
12983.c
Partial Judge Header
12983.h
Tags