Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 89 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
89
Dung lượng
712,6 KB
Nội dung
SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen ChapterSetsandFunctions Contents SetsDiscreteStructuresforComputerScience(CO1007) on Ngày tháng 10 năm 2016 Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Nguyen An Khuong, Huynh Tuong Nguyen Faculty of ComputerScienceand Engineering University of Technology, VNU-HCM 4.1 Contents SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Sets Contents Sets Set Operation Set Operation FunctionsFunctions One-to-one and Onto Functions Sequences and Summation Recursion One-to-one and Onto Functions Sequences and Summation Recursion 4.2 Set Definition SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen • Set is a fundamental discrete structure on which all discretestructures are built • Sets are used to group objects, which often have the same properties Contents Sets Set Operation Example • Set of all the students who are currently taking Discrete Mathematics course • Set of all the subjects that K2011 students have to take in Functions One-to-one and Onto Functions Sequences and Summation Recursion the first semester • Set of natural numbers N Definition A set is an unordered collection of objects The objects in a set are called the elements (phần tử ) of the set A set is said to contain (chứa) its elements 4.3 Notations SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Definition • a ∈ A: a is an element of the set A • a∈ / A: a is not an element of the set A Contents Sets Set Operation Functions One-to-one and Onto Functions Definition (Set Description) • The set V of all vowels in English alphabet, V = {a, e, i, o, u} Sequences and Summation Recursion • Set of all real numbers greater than 1??? {x | x ∈ R, x > 1} {x | x > 1} {x : x > 1} 4.4 Equal SetsSetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Contents Definition Sets Two sets are equal iff they have the same elements Set Operation Functions • (A = B) ↔ ∀x(x ∈ A ↔ x ∈ B) One-to-one and Onto Functions Sequences and Summation Example Recursion • {1, 3, 5} = {3, 5, 1} • {1, 3, 5} = {1, 3, 3, 3, 5, 5, 5, 5} 4.5 Venn Diagram SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Contents • John Venn in 1881 • Universal set (tập vũ trụ) is represented by a rectangle • Circles and other geometrical figures are used to represent setsSets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion • Points are used to represent particular elements in set 4.6 Special SetsSetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation • Empty set (tập rỗng ) has no elements, denoted by ∅, or {} • A set with one element is called a singleton set Functions One-to-one and Onto Functions • What is {∅}? Sequences and Summation • Answer: singleton Recursion 4.7 Subset SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Definition The set A is called a subset (tập con) of B iff every element of A is also an element of B, denoted by A ⊆ B Contents Sets Set Operation Functions If A = B, we write A ⊂ B and say A is a proper subset (tập thực sự) of B One-to-one and Onto Functions Sequences and Summation Recursion • ∀x(x ∈ A → x ∈ B) • For every set S, (i) ∅ ⊆ S, (ii) S ⊆ S 4.8 Cardinality SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Definition If S has exactly n distinct elements where n is non-negative integers, S is finite set (tập hữu hạn), and n is cardinality (bản số ) of S, denoted by |S| Contents Sets Set Operation Example • A is the set of odd positive integers less than 10 |A| = • S is the letters in Vietnamese alphabet, |S| = 29 • Null set |∅| = Functions One-to-one and Onto Functions Sequences and Summation Recursion Definition A set that is infinite if it is not finite Example • Set of positive integers is infinite 4.9 Power Set SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Definition Given a set S, the power set (tập lũy thừa) of S is the set of all subsets of the set S, denoted by P (S) Contents Sets Set Operation Functions Example What is the power set of {0, 1, 2}? P ({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}} One-to-one and Onto Functions Sequences and Summation Recursion Example • What is the power set of the empty set? • What is the power set of the set {∅} 4.10 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.75 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.76 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.77 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.78 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.79 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.80 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.81 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.82 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.83 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.84 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.85 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion Moved disc from peg to peg 4.86 SetsandFunctions Tower of Hanoi – Discs Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets OK Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recursion 4.87 SetsandFunctions Tower of Hanoi Nguyen An Khuong, Huynh Tuong Nguyen Algorithm procedure hanoi(n, A, B, C) if n = then move the disk from A to C else call hanoi(n − 1, A, C, B) move disk n from A to C call hanoi(n − 1, B, A, C) Contents Sets Set Operation Functions One-to-one and Onto Functions Sequences and Summation Recurrence Relation Recursion H(n) = 2H(n − 1) + if n = if n > Recurrence Solving H(n) = 2n − If one move takes second, for n = 64 264 − ≈ × 1019 sec ≈ 500 billion years! 4.88 Homeworks and Exercises SetsandFunctions Nguyen An Khuong, Huynh Tuong Nguyen Contents Sets Set Operation Functions Solve exercises in the attachment Try to solve as much as possible related exercises in Rosen’s book One-to-one and Onto Functions Sequences and Summation Recursion 4.89