While reading the classic text Introduction to Algorithms by Cormen et. al. I came across the following claim:

Sets are as fundamental to computer science as they are to mathematics. Whereas mathematical sets are unchanging, the sets manipulated by algorithms can grow, shrink, or otherwise change over time. We call such sets

.dynamic

I felt a bit odd after reading the statement that "set" in Mathematics and in CS are different from the mutable point of view. Now in Mathematics what we deal with are theoretical aspect of things and as such "set" is a theoretical concept and so it is in Theoretical CS. If it is immutable in mathematics then so it is in CS. Mathematics and Theoretical CS are interlinked. So given a graph algorithm which say finds the minimum shortest path between a pair of vertices , we can’t say whether it belongs to Mathematics or CS.

Often in algorithms we write statements as :

$ $ S = S \cup \{a\} \quad \text{view $ 1$ }$ $

Which seems to sort of change our set $ S$ , but if we look it in this way:

$ $ S’= S \cup \{a\} \quad \text{view $ 2$ }$ $

$ $ S=S’$ $

So in the second situation we are not modifying our actual set $ S$ we are forming a new set $ S’$ with $ S$ augmented with $ a$ and then after that we are making the variable $ S$ refer to $ S’$ .

What I feel is that the concept of the set being mutable or immutable is solely dependent on the data-structure of representation of the abstract concept of "sets" and since in data-structure the two steps in view $ 2$ are combined and implemented, so they are called *dynamic sets*.

In short I feel that *Dynamic Sets* are data-structure implementation of sets and not the abstract sets.