| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11753 | Delete Middle Node |
|
| 11754 | Names and Heights |
|
| 11755 | Sequences Sorting |
|
| 11757 | Merry Christmas |
|
Description
In this problem, you are asked to implement 4 functions:
1. void Create_List(Node**, int);
This function is used to create the linked list according to the input.
2. Node* Delete_Middle_Node(Node*);
This function is used to find the middle node of the linked list, and delete it.
We have to return the processed linked list.
Notice: if the number of integers are even, the middle node should be (n/2)+1 th node.
3. void Print_List(Node*);
This function is used to print out the key value in the linked list.
4. void Free_List(Node*);
This function is used to free the memory space.
Below is correct Create_List function, we implement it for you, you can just copy and paste.
void Create_List(Node** head, int data)
{
if(*head==NULL){
*head = (Node*)malloc(sizeof(Node));
(*head)->data = data;
(*head)->next = NULL;
}
else{
Node* temp = *head;
while(temp->next!=NULL) temp = temp -> next;
Node* new_node = (Node*) malloc(sizeof(Node));
temp->next = new_node;
new_node->next = NULL;
new_node->data = data;
}
}
Input
The input contains one line of several integers.
The line represents a linked list, and each integer is a node of the linked list.
Each line of input is ended by -1, and you don't need to add a new node with key value -1.
It is guaranteed that:
- Each key value in the node is an integer between 0 and 1000.
- Each linked list has less than 1000 nodes.
Output
You need to output the linked list which has been through the deletion of middle node.
Each key value is separated by "->".
Sample Input Download
Sample Output Download
Partial Judge Code
11753.cPartial Judge Header
11753.hTags
Discuss
Description
Difficulty: ★☆☆☆☆
Given a set of names and numbers , please sort them seperately and print out !
1. You should sort the names in alphabetical order .
In alphabetical order , "A" has the highest priority and "Z" has the lowest priority.
For example , if there are 3 names : Bruce , Adam , Wendy , Alex .
You should print the names in order : Adam , Alex , Bruce , Wendy.
Because "A" has the highest priority , you should print out the names beginning with "A"
Because "d" has higher priority than " l " , you should print out Adam before Alex
2. You should sort the numbers in acsending order .
3. If you encounter Time Limit Exceeds (TLE) , you can use "qsort" to speed up your program
Input
The first line contains an integer N , indicating the number of people. (2 <=N<=80)
There are following 2N lines.
There are N names in 2nd ~ N+1 th lines . Each lines contains a name. (3<= length of name <=20)
There are N integers in N+2 th ~ 2N+1 th lines . Each lines contains an integer indicating the height of somebody
Output
Print out the name in alphabetical order and height in acsending order .
1. Output format : printf("%s %d\n",NAME,HEIGHT) ;
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Difficulty: ★☆☆☆☆
Given an orderless integer sequence
Please sort the sequence in ascending order
Input
The first line contains a integer N, indicating the number of testcases.
You can use this format in your code:
int i , N;
scanf("%d",&N);
for(i=0;i<N;i++){
// your code to deal with each testcase
}
The following lines are testcases.
Each testcase contains an integer sequence . the number in the integer sequence will be 0 ~ 9.
And the length of the integer sequence is smaller than 20.
There might be duplicated integers in the integer sequence
Output
The integer sequence sorted ascending.
Note that you have to add '\n' at the end of output