# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12920 | Implement Queue Using Linked List |
|
12922 | Where's Wally? |
|
Description
Please use the provided two files, main.c and function.h, to implement a queue. Includes following functions:
- Enqueue: insert an element into a queue.
- Dequeue: remove an element from a queue.
- Print the first element: print the first element’s value inside a queue.
- Print the last element: print the last element’s value inside a queue.
- Check if it is empty: Check if a queue is empty.
Note that:
- A Queue data structure shold follow FIFO(first in first out) rule.
- The first element means the first insert element, and the last element means the latest insert element.
- Print nothing if there is no first element and the last element.
Go download function.c, and only need to submit function.c.
Input
Legal commands:
- “enqueue” with an integer N in a new line: Insert an element which value is N into the queue.
- “dequeue”: remove the first element inside the queue and return its pointer. If the queue is empty return NULL.
- “front”: peak the first element inside the queue and print its value. Print nothing if the queue is empty.
- “back”: peak the last element inside the queue and print its value. Print nothing if the queue is empty.
- “isempty?”: Check if the queue is empty, and print "Yes\n" or "No\n".
- “debug”: You may use this to traversal your queue and check if it’s correct. Use it!!!
Output
No need to handle output. Please use function.c above.
Sample Input Download
Sample Output Download
Partial Judge Code
12920.cPartial Judge Header
12920.hTags
Discuss
Description
Given a 7 times 7 character board. Please find the word “WALLY” that can be formed by a sequence of adjacent characters on the board and highlight all alphabets in the sequence.
Note that:
- It might not has a solution or has one(more than one) solution.
- Allow to search eight possible directions.
Input
A word puzzle map.
Note that:
- Use Capital letter ‘A~Z’ to represent alphabets inside the map.
- Use ‘-’ to hide the alphabets which are not a solution.
- Need a ‘Space’ between any two characters.
// Possible puzzle map
Z C G C O T Q
J W B C W E W
J Z A L L R R
H Q K A Y M F
K T W L P G H
Q D P G E G J
Q S V C C Y Z
// Puzzle solved map
- - - - - - -
- W - - - - -
- - A L L - -
- - - A Y - -
- - W - - - -
- - - - - - -
- - - - - - -
Output
Output should follow below format:
c c c c c c c
c c c c c c c
c c c c c c c
c c c c c c c
c c c c c c c
c c c c c c c
Note that:
- Need to have a return value('\n') at the end of your string.
- Character c is one of ‘-’, ‘W’, ’A’, L’, ‘Y’.