程式題目如下:
<a.3> Example:
input set : S = {1,2,3,4,5,6};
relations : 1≡2, 3≡4, 1≡4, 5≡6
equivalence class: {1,2,3,4}; {5,6}
(B) Programming
Input Format : (Assume we have two testing pattern.)
#1# <-------Testing pattern 1
4 <------- The numbers of the relation
1 6 <------- Lower bound and upper bound of the input set
1 2 <------- Relation 1≡2
3 4 <------- 3≡4
1 4 <------- 1≡4
5 6 <------- 5≡6
#2# <------Testing pattern 2
2
1 3
1 2
1 3
|
Remark : There is one
space symbol
between twomembers of the input set.
Output Format :
#1# <------Output of testing pattern 1
2 <------ The numbers of the equivalence class
1 2 3 4 <------ Class 1(after sorting,i.e.,(1<2<3<4),(5<6),(1<5))
5 6 <------ Class 2
#2# <-----Output of testing pattern 2
1
1 2 3
|
Remark : There is one
space symbol
between twomembers of the input set.
我不會寫這題程式, 連個演算法都生不出來, 不過老師友說這題要用鏈結串列來寫(linked list)