Problem 2.1 symmetry definition

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

Problem 2.1 symmetry definition
Hi, I have a question regarding Problem 2.1, Task 4:

For determining if a tree is symmetrical, should we only look at the structure, or also at the contents?
If we assume that the tree is sorted, it would not really make sense to compare the contents.


Yes, you should only look at the structure.


I’m still not quite shure how symmtery is defined. Is the following example symmetric, or do the subtrees have to be symmetric as well?

     o
   /   \
 o      o
/         \

o o


Yes, the example you give is symmetric. The idea is that the right subtree is a mirror image of the right subtree.

I was reusing an old problem and did not realise just how problematic the symmetry definition was. We’ll grade generously :).

1 „Gefällt mir“