Program to find equivalence classes Instructor : Prof. Jyh-Shing Roger Jang Designer ： Shao-Huan Wang The ideas are reference to the textbook “Fundamentals.

Presentation on theme: "Program to find equivalence classes Instructor : Prof. Jyh-Shing Roger Jang Designer ： Shao-Huan Wang The ideas are reference to the textbook “Fundamentals."— Presentation transcript:

Program to find equivalence classes Instructor : Prof. Jyh-Shing Roger Jang Designer ： Shao-Huan Wang The ideas are reference to the textbook “Fundamentals of Data Structures in C “.

Program to find equivalence classes 01234567891011 First, we input many pair of numbers and 40 (0,4) 1310698 (3,1)(6,10)(8,9)

4211007961108 Program to find equivalence classes 01234567891011 3684 (7,4)(6,8)(3,5)(2,11)(11,0) 3511 First, we input many pair of numbers and (0,4)(3,1)(6,10)(8,9) And add the number from the bottom if the space isn’t empty

4209110 Program to find equivalence classes 01234567891011 36843 57860 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. stack Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number.

4209110 Program to find equivalence classes 01234567891011 36843 57860 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 11 stack If the number is already used, skip it.

729110 Program to find equivalence classes 01234567891011 36843 5860 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 If the number is already used, skip it. 11 stack 2

29110 Program to find equivalence classes 01234567891011 3683 586 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 If the number is already used, skip it. stack 2 New class: 1 3

9110 Program to find equivalence classes 01234567891011 683586 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 If the number is already used, skip it. 2 New class: 13 3 stack 5

910 Program to find equivalence classes 01234567891011 683586 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 If the number is already used, skip it. 2 New class: 13 stack 5 New class: 6

910 Program to find equivalence classes 01234567891011 6886 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 If the number is already used, skip it. 2 New class: 13 stack 5 New class: 6810

9 Program to find equivalence classes 01234567891011 6886 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 If the number is already used, skip it. 2 New class: 13 stack 5 New class: 68109

9 Program to find equivalence classes 01234567891011 8 From 0 to 11 if the number is unused, print “New class”, print and mark the number become used. Print: New class: 0 And from its link to find another number, if the linked number also link another number, push the linked number to stack. 114 Then, from the top of stack to find the same class number. 7 If the number is already used, skip it. 2 New class: 13 stack 5 New class: 68109

Download ppt "Program to find equivalence classes Instructor : Prof. Jyh-Shing Roger Jang Designer ： Shao-Huan Wang The ideas are reference to the textbook “Fundamentals."

Similar presentations