1418 - I2P(II) 2018_Chen_Lab2 Scoreboard

Time

2018/03/30 13:20:00 2018/03/30 15:20:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11855 Binary Tree Operations_v2
11856 Postfix Expression

11855 - Binary Tree Operations_v2   

Description

This is a partial judge problem (Judge Language :  C)

Please download the partial judge code and header.

Then, implement 2 functions : buildTree() and showPreorder()

You have to build the binary tree according to its inorder and postorder.

Next , print out the preorder of the binary tree!

 

Submit format:

#include <stdio.h>

#include <stdlib.h>

#include "function.h"

Node* buildTree(int* inorder, int* postorder, int inorder_start, int inorder_end){

        /*YOUR CODE HERE*/

}

void showPreorder(Node* root){
      /*YOUR CODE HERE*/

}

Input

There are 3 lines for inputs.

The first line contains an integer N , which indicates the number of nodes of the binary tree.

The second line is the inorder traversal of the binary tree

The third line is the postorder traversal of the binary tree

※Note that there are not duplicated integers in the binary tree

Output

Print out the preorder traversal of the binary tree.

Note that :

1.There is an whitespace between each integer. 

2.There is an whitespace after the last integer.

3.Threre is no need to add "\n" at last 

Sample Input  Download

Sample Output  Download

Partial Judge Code

11855.c

Partial Judge Header

11855.h

Tags




Discuss




11856 - Postfix Expression   

Description

Give a postfix expression, which has 4 operators, ‘+’ , ‘-’, '*' , '/',and positive integers. Print the result.

Notice: testcases don't include parentheses so just follow arithmetic rule.

            And you don't need to consider divide 0 or some tricky rules : )

Input

The input contains exactly 1 sequences of postfix expression. It contains operators, ‘+’  ‘-’ '*' '/',and positive integers separated by a space.

The end of the input is 0.

The length of input sequence is smaller than or equal to 40

 

Output

The output is the result of the expression.

There is a newline symbol in the end

Sample Input  Download

Sample Output  Download

Tags




Discuss