Depth-first Unary Degree Sequence - Information Camouflage
bruceediger.com·11w
🌳Huffman Trees
Preview
Report Post

The old Daily Coding Problem email list gave us this problem around 2020:

Daily Coding Problem: Problem #237 [Easy]

A tree is symmetric if its data and shape remain unchanged when it is reflected about the root node. The following tree is an example:

4
/ | \
3   5   3
/           \
9             9

Given a k-ary tree, determine whether it is symmetric.

This problem is less well described than I thought when I worked on it in 2020.


I did not see an implicit “all child nodes are non-nil” in the problem. I let every node of the “k-ary” trees have an arbitrary number of child nodes, and also have nil-valued child nodes.

As part of testing my solution to the problem, I wrote a parser for a lisp-like “balanced …

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help