A set is a well defined collection of distinct objects. The objects that make up a set (also known as the elements or members of a set) can be anything: numbers, people, letters of the alphabet, other sets, and so on.
Computer Representation of Sets
Method for storing elements using an arbitrary ordering of the elements of the universal set.Specify an arbitrary ordering of the elements of U, for instance a1, a2, . . . , an.
Represent a subset A of U with the bit string of length n, where the ith bit in the string is 1 if ai belongs to A and is 0 if ai does not belongs to A.
Example:
– Let U = {1,2,3,4,5,6,7,8,9,10}, and the ordering of elements of U has the elements in increasing order.
i)What bit string represents the subset of all odd integers in U?
The bit string that represents the set of odd integers in U, {1, 3, 5, 7, 9}, has a one bit in the first, third, fifth, seventh, and ninth positions. It is 10 1010 1010
Solution: 10 1010 1010
ii)What bit string represents the subset of all even integers in
U?
The bit string that represent the subset of even integers in U,{2, 4, 6, 8, 10}.
It is 01 0101 0101.
iii)What bit strings represent the subset of integers not exceeding 5 in U?
The set of all integers in U that do not exceed 5, {1, 2, 3, 4, 5}, is represented by the
string 11 1110 0000.
To find the bit string for the complement of a set from the bit string for that set, change each 1 to 0 and each 0 to 1.
Comments
Leave a comment