Question

Specifically, the concept of set referred to here: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-16.html#%_sec_2.3.3

I understand how the data structures work and how to traverse through them, but the use of it is tougher to conceptualize.

Would someone mind explaining it in different words, perhaps that might help it click. Thanks so much.

Was it helpful?

Solution

If you have a set (a b c), then trying to insert a into it will result in the same set (a b c). It is just a collection that has the constraint/guarantee that no value will be duplicate.

Example use: You want to find all words used in a text, but their frequencies are irrelevant. If you have a set, then the algorithm is just: go through all words and add each into the set. Since the set automatically throws away all duplicates, it is the correct result when you finish.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top