# Explain the concept of set in TOC?

Data Structure AlgorithmsComputer ScienceComputers

A set is an unordered collection of objects or an unordered collection of elements. Sets are always written with curly braces {}, and the elements in the set are written within the curly braces.

Examples

• The set {a, b, c} has elements a, b, and c.

• The sets {a, b, c} and {b, c, b, a, a} are the same since order does not matter in a set and since redundancy also does not count.

• The set {a} has element a. Note that {a} and a are different things; {a} is a set with one element a.

• The set {xn: n = 1, 2, 3, . . .} consists of x, xx, xxx, . . ..

• The set of even numbers {0, 2, 4, 6, 8, 10, 12, . . .} is {2n where n = 0, 1, 2, . . .}. In general, note that 0 is an even number.

• The set of positive even numbers {2, 4, 6, 8, 10, 12, . . .} is {2n where n =1, 2, 3, . . .}.

• The set of odd numbers {1, 3, 5, 7, 9, 11, 13, . . .} is {2n + 1where n =0, 1, 2, . . .}

The basic relations in the set can be characterized as −

• A set L1 is a subset of set L if and only if every element of L1 is also an element of L.

• A set L1 is a proper subset of set L if and only if every element of L1 is also elements of L, but there are few elements in L that are not elements of L1.

• The intersection of two sets L and M is the set X of all elements x such that x is in L and x is in M.

• The union of two sets L and M is the set Y of all elements y such that y is in L or y is in M, or both.

Example

Consider an example that how to work on regular sets by performing union operation on a set −

The given set is X. we have to prove that (X)* = (X*)*.
Let, the language accepted by (X*)* be L((X*)*) . .
L((X*)*) = L(X*)^0 U L(X*)^1 U L(X*)^2 U L(X*)^3 .......
= Ɛ U L(X*) U (L(X*) U L(X*)) U ( L(X*) U L(X*) U L(X*) ) .............
= L(X*) U (L(X*) U L(X*)) U ( L(X*) U L(X*) U L(X*) ) ............. [ since Ɛ U A =A ]
= L(X*)
Since both languages are same, it is proved that −
(X)* = (X*)*.
Updated on 16-Jun-2021 13:25:26