2025 - DS_20_CHEN_QUIZ3 (EECS2040) Scoreboard

Time

2020/05/11 18:30:00 2020/05/11 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12792 Brute-forcibly Finding Tree Anagrams

12792 - Brute-forcibly Finding Tree Anagrams   

Description

Anagrams means "變位字" in Chinese. Assume we have a word  "HEART"  and we want "HEART" to be the level-order sequence and "EARTH" to be the in-order sequence, the tree would exist. However, if we set "EARTH" to be the level-order sequence and "HEART" to be the in-order sequence, then the tree will not exist.

Input

1. Size in the following heap array

2. The given tree in the heap format

3. Number of the following word pairs

Output

Is each pair of words anagrams according to the given tree? Yes or No

Sample Input  Download

Sample Output  Download

Tags




Discuss