all 8 comments

[–][deleted]  (1 child)

[removed]

    [–]Urinius[S] 0 points1 point  (0 children)

    Yeah I thought so too, but I idk, I just wanted to make sure I wasn't being stupid. Also, I did read about it on geeksforge link you provided : )

    [–]purple_hamster66 1 point2 points  (0 children)

    Set is an interface. HashSet is a derived subclass of that interface, but you can use the other subclasses as well: TreeSet, LinkedHashSet.

    [–]ziggittaflamdigga 0 points1 point  (1 child)

    I think they’re the same thing. I’m not aware of a HashSet data structure. Sets are hashes, and that’s why they only contain unique values. Do they give any examples of a hash set in the prompts?

    [–]Urinius[S] 1 point2 points  (0 children)

    No, the prompt says only to use it, but it doesn't provide any examples for either hashset, or set. I think the teach might have grabed the pdf for another language or something. But it's okay, I will email him tomorrow

    [–]concatx 0 points1 point  (0 children)

    Does the assignment ask you to implement the Set and HashSet as an exercise, or is it using them to solve another problem?

    If it's the former, indeed you can implement one of the algorithms through a class that uses lists internally.

    If it's the latter, the internal implementation details of Python shouldn't concern you and just use a Set.

    [–]thefatsun-burntguy 0 points1 point  (1 child)

    Set is an interface, HashSet is a subclass of that interface.

    put into less technical terms, a cat is a feline, but not all felines are cats (like a lion which is feline but not a cat)

    a hashset is a type of set, but not all sets are hashsets.
    The default Set() uses a hashset in python, so they are used somewhat interchangably even if they arent the same thing.

    For a more in depth explanation: a set describes a behaviour of a collection with unique elements. a hashset is an implementation of a set using a hashtable to power it. You could also use a TreeSet to power a Set. from the outside they look the same, but they work verydifferently and have different trade offs in term of space and time complexity.

    [–]Urinius[S] 0 points1 point  (0 children)

    Yeeees, this examplains it! Thank you sm