How do you program a method that calculates the height of a tree?

How do you program a recursive method in Java that calculates the height of a tree? It's kind of complicated. Here's the method header:

protected int tellmepleasetheheightofthetree(BinaryTree baum){

I can't get any further with my thoughts here.

(2 votes)
Loading...

Similar Posts

Subscribe
Notify of
5 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
BrascoC
1 year ago

Also grundlegend bräuchtest du erst mal Variablen, aus denen man die Höhe berechnen kann. Weil: “Sag höhe Baum” funktioniert nicht.

BrascoC
1 year ago
Reply to  Gutofruto

Du solltest mal bitte genau erklären, was du machen möchtest.

Carbonfree
1 year ago

Rechtwinkliges Dreieck ist gar nicht kompliziert. Gradmessung per Peilung und fertig.