T
T
Timofey Lanevich2017-05-23 10:05:29
Python
Timofey Lanevich, 2017-05-23 10:05:29

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?
880f7e0708f541efb6edfb7e492cce6c.pngc8eea6da5c9a46c68e58e9be26ba42f0.png
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexander, 2017-05-23
@Timak31

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.

C
chupasaurus, 2017-05-23
@chupasaurus

And no one thought that this is just pseudocode with the syntax of several languages ​​mixed in?

M
Maxim Moseychuk, 2017-05-23
@fshp

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.

D
DuD, 2017-05-23
@DuD

I could be wrong, but it looks like Go.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question