11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sec. 2.1 Sets <strong>and</strong> Rel<strong>at</strong>ions 25A sequence is a collection of elements with an order, <strong>and</strong> which may containduplic<strong>at</strong>e-valued elements. A sequence is also sometimes called a tuple or a vector.In a sequence, there is a 0th element, a 1st element, 2nd element, <strong>and</strong> soon. I indic<strong>at</strong>e a sequence by using angle brackets 〈〉 to enclose its elements. Forexample, 〈3, 4, 5, 4〉 is a sequence. Note th<strong>at</strong> sequence 〈3, 5, 4, 4〉 is distinct fromsequence 〈3, 4, 5, 4〉, <strong>and</strong> both are distinct from sequence 〈3, 4, 5〉.A rel<strong>at</strong>ion R over set S is a set of ordered pairs from S. As an example of arel<strong>at</strong>ion, if S is {a, b, c}, then{〈a, c〉, 〈b, c〉, 〈c, b〉}is a rel<strong>at</strong>ion, <strong>and</strong>{〈a, a〉, 〈a, c〉, 〈b, b〉, 〈b, c〉, 〈c, c〉}is a different rel<strong>at</strong>ion. If tuple 〈x, y〉 is in rel<strong>at</strong>ion R, we may use the infix not<strong>at</strong>ionxRy. We often use rel<strong>at</strong>ions such as the less than oper<strong>at</strong>or (

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!