I've been searching for information about the Set Abstract Data Type (ADT) online, but I keep running into different results. When I search for 'Set ADT', I see a few resources pop up, but they seem to disagree on some key aspects. For instance, Brilliant.com says a Set has an 'inserts()' method, while others claim it uses 'add()'. Why can't we come to a consensus on what methods ADTs should have? Do people really take these concepts seriously?
3 Answers
It sounds like you found some information, so it wasn't too tough to find! It's worth noting that different programming languages have their own conventions. For example, in Python, you might use 'my_list.append(42)', whereas in Java, it's 'myList.add(42)'. Each language defines its methods differently for sets, which adds to the confusion.
Absolutely! ADTs are supposed to be independent of any programming language. We may agree on the operations an ADT should implement, but the names can vary widely. That's just part of how different programming cultures have developed.
We often have varying names for functionalities in Abstract Data Types (ADTs). An ADT's definition leans more towards the semantics of its operations rather than the specific names we choose to use for those operations.
True! And it's interesting to see how other languages handle it. Like in C++ you have 'myVector.push_back(42)'. It can definitely feel overwhelming with all the different conventions.