129 - 2012 Data Structure Final (補考) Scoreboard

Time

2012/06/20 15:18:00 2012/06/20 17:45:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
1416 BST Problem 1 (I)
1419 BST Problem 2 (I)
1422 BST Problem 3 (I)

1416 - BST Problem 1 (I)   

Description

In this problem, please implement a binary search tree (BST).
You have to implement the following methods:


(1) Insert x:
      Insert an integer x into the BST if x hasn’t in the BST yet.
(2) Size x:
      Find the node x in the BST and print the number of nodes in this subtree.
      If x isn't in the BST, print -1.

Input

 For each subproblem:

(1) 1416: N <= 200
(2) 1417: N <= 10000
(3) 1418
: N <= 60000

N is the number of nodes in the tree.

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1419 - BST Problem 2 (I)   

Description

 

In this problem, please implement a binary search tree (BST).
You have to implement the following methods:


(1) Insert x:
      Insert an integer x into the BST if x hasn’t in the BST yet.
(2) Depth x:
      Find the node x in the BST and print the depth of x.
      The depth of root is 0. If x isn't in the BST, print -1.

 

Input

For each subproblem:

(1) 1419: N <= 2000
(2) 1420: N <= 20000
(3) 1421: N <= 50000

N is the number of nodes in the tree.

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




1422 - BST Problem 3 (I)   

Description

In this problem, please implement a binary search tree (BST).
You have to implement the following methods:

(1) Insert x:
      Insert an integer x into the BST if x hasn’t in the BST yet.
(2) Height x:
      Find the node x in the BST and print the height of the node in this subtree.
      If x isn't in the BST, print -1. The height of leaf is 0.

Input

For each subproblem:

(1) 1422: N <= 2000
(2) 1423: N <= 20000
(3) 1424: N <= 50000
N is the number of nodes in the tree.

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss