Reputation: 21
Online I found some code that used the variable explored
.
This variable is implemented like a dictionary: explored = {rootId}
, but it doesn't have key-value association, moreover this variabile uses the function .add(elem)
while the dict doesn't have this function.
eg. explored.add(elem)
.
Which data structure is that? (I'm using python 3.6.3)
Upvotes: 1
Views: 96
Reputation: 1855
Might be a set, it has a method "add", but you could simply print the type, such as:
print(type(explored))
Upvotes: 3
Reputation: 73366
It's a set
. There are also online examples that use the methods you mentioned.
Next time you wonder, I suggest you just print the type, like this:
print(type(explored));
Upvotes: 2
Reputation: 1358
It's the set
datastructure.
Here's a link to it on the official docs: https://docs.python.org/3/tutorial/datastructures.html#sets
Upvotes: 0