About
A set is:
- a data structure of the set theory
- a collection of distinct objects (then without duplicate)
- an unordered collection of objects
The objects element of the set have the same type (the type may be a composed type such as a tuple)
The mathematical concept of a set is a group of unique items, meaning that the group contains no duplicates (theory) but many data application have extended this definition with a bag (multiset) (such as a table)
The set is used to perform distinct operation (ie deleting duplicates)
Articles Related
Examples
In Programming language
Some real-world examples of sets include the following:
- The set of uppercase letters 'A' through 'Z'
- The set of nonnegative integers {0, 1, 2 …}
- The set of reserved Java programming language keywords {'import', 'class', 'public', 'protected'…}
- A set of people (friends, employees, clients, …)
- The set of records returned by a database query - See resulset (in java)
- The set of Component objects in a Container
- The set of all pairs
- The empty set {}
In Computer Science
- The idea of a “connection pool” is a set of open connections to a database server.
- Web servers have to manage sets of clients and connections.
- File descriptors provide another example of a set in the operating system.
Basic properties of sets
The basic properties of sets:
- Sets contains only one instance of each item
- Sets may be finite or infinite
- Sets can define abstract concepts
Set expression
Set of Non-negative number
In Mathese, “the set of non-negative numbers” is written like this:
delim{lbrace}{ x in bbR : x>= 0}{rbrace}where:
- The colon stands for “such that”
- the part before the colon specifies the elements of the set, and introduces a variable to be used in the second part
- the part after the colon: defines a filter rule
The above notation can also be shortened if x is wel known :
delim{lbrace}{ x : x>= 0}{rbrace}Another example
Another example where the set consists of
1/2and
1/3delim{lbrace}{ x : x^2 - {5/6}x + {1/6} = 0}{rbrace}Tuple
Tuples examples in set expression:
- The set expression of all pairs of real numbers in which the second element of the pair is
the square of the first can be written:
delim{lbrace}{(x,y) in bbR x bbR : y = x^2 }{rbrace}of abbreviated:
delim{lbrace}{(x,y) : y = x^2 }{rbrace}- The set expression of triples consisting of nonnegative real numbers.