-->
当前位置:首页 > 题库

PROGRAMMING:Judgment on heap

Luz5年前 (2021-05-10)题库505
Insert a series of given numbers into an initially empty small top heap 'H [] in sequence. Then judge whether a series of related propositions are true. There are several propositions
-'x is the root':'x 'is the root node;
-'x and y are siblings':'x' and 'y' are siblings;
-'x is the parent of Y':'x 'is the parent of' y ';
-'x is a child of Y':'x 'is a child of' y '.
###Input format:
The first line of each group of tests contains two positive integers' n '($$Le $$1000) and'm' ($$Le $$20), which are the number of inserted elements and the number of propositions to be judged. The next line gives the 'n' integers in the interval $[- 10000, 10000] $, which are to be inserted into an initially empty small top heap. After that,'m 'lines, each line gives a proposition. The topic guarantees that the node key values in the proposition exist.
###Output format:
For each input proposition, if it is true, output't 'in one line, otherwise output' f '.
###Input example:
```in
5 4
46 23 26 24 10
24 is the root
26 and 23 are siblings
46 is the parent of 23
23 is a child of 10
```
###Output example:
```out
F
T
F
T
```






answer:If there is no answer, please comment