Answer the question
In order to leave comments, you need to log in
What is this programming language and what is T?
I don't know what programming language it is. I want to write such a structure in python or something like that. And what is T?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
I can’t say about the language, but it’s clearly something strongly typed and T is some kind of type. Python is not a strongly typed language, it doesn't specify a type, so you don't even need to know what T is to write something like this in Python.
And there are no structures in python, the closest analogue is namedtuple.
But I suggest doing it through a normal class, and make inorderTraversal a method.
And no one thought that this is just pseudocode with the syntax of several languages mixed in?
The type T is an arbitrary type. A structure describes a tree node that can store some type.
For a tree of strings, String will be substituted for T, for a tree of integers - Int, and so on.
The Node type is a polymorphic type (parametric polymorphism).
In C++ this is implemented by templates, in Java by generics.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question