20 lines
1.1 KiB
Plaintext
20 lines
1.1 KiB
Plaintext
JVM: Eclipse Adoptium 25.0.5, ThreadStackSize=1024 KB, cores=2
|
|
Built a left-skewed tree with 1000000 nodes using a loop (no recursion).
|
|
|
|
Depth reached by a recursive probe before StackOverflowError (3 attempts in one JVM):
|
|
attempt 1: StackOverflowError after reaching depth 21258
|
|
attempt 2: StackOverflowError after reaching depth 29514
|
|
attempt 3: StackOverflowError after reaching depth 29514
|
|
|
|
RecursiveTraversals.inorder on the same tree:
|
|
caught java.lang.StackOverflowError
|
|
stack trace length: 1024 frames (the JVM truncates traces; the real depth is larger)
|
|
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
|
|
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
|
|
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
|
|
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
|
|
...
|
|
|
|
IterativeTraversals.inorder on the same tree:
|
|
visited 1000000 nodes, first=1000000, last=1, no error
|