-- Sep 19 In-Class Exercise Thread
1. Due to the different order in the FDs, the effect is that the while loop will run thrice this time instead of just twice like before.
After the first run of the while loop, X={A,B,C}.
After the second run of the while loop, X = {A,B,C,D,E}
And the third run does not change X.
Since the same set of FDs are used, albeit in a different order, hence the result of the closure of {A,B} will be the same, with X = {A,B,C,D,E}
2. Closure of {C,D,F} using FDs BC→D, D→E, AB→C, BC→A, and CF→B
Step 1: BC→D, D→E, AB→C, BC→A, and CF→B
Since {C,D,F}≠∅ execute while loop first time.
Set Xold={C,D,F}
Execute for each loop
first time: FD BC→D, B,C not∈{C,D,F}, no change to X.
second time: FD D→E, D∈{C,D,F}, add E to X, X = {C,D,E,F}
third time: FD AB→C, A,B not∈{C,D,E,F}, no change to X.
fourth time: FD BC→A, B,C not∈{C,D,E,F}, no change to X.
fifth time: FD CF→B, C,F∈{C,D,E,F}, add B to X, X = {B,C,D,E,F}
Since X={B,C,D,E,F} and Xold={C,D,F}, loop second time:
Set Xold={B,C,D,E,F}
Execute for each loop
first time: FD BC→D, no change to X.
second time: FD D→E, no change to X.
third time: FD AB→C, A,B not∈{B,C,D,E,F}, no change to X.
fourth time: FD BC→A, B,C∈{B,C,D,E,F}, add A to X. X = {A,B,C,D,E,F}
fifth time: FD CF→B, no change to X.
Since X={A,B,C,D,E,F} and Xold={B,C,D,E,F}, loop third time:
No change in X, so closure of {C,D,F} is X={A,B,C,D,E,F}
(
Edited: 2018-09-19)
1. Due to the different order in the FDs, the effect is that the while loop will run thrice this time instead of just twice like before.
After the first run of the while loop, X={A,B,C}.
After the second run of the while loop, X = {A,B,C,D,E}
And the third run does not change X.
Since the same set of FDs are used, albeit in a different order, hence the result of the closure of {A,B} will be the same, with X = {A,B,C,D,E}
2. Closure of {C,D,F} using FDs BC→D, D→E, AB→C, BC→A, and CF→B
Step 1: BC→D, D→E, AB→C, BC→A, and CF→B
Since {C,D,F}≠∅ execute while loop first time.
Set Xold={C,D,F}
Execute for each loop
first time: FD BC→D, B,C not∈{C,D,F}, no change to X.
second time: FD D→E, D∈{C,D,F}, add E to X, X = {C,D,E,F}
third time: FD AB→C, A,B not∈{C,D,E,F}, no change to X.
fourth time: FD BC→A, B,C not∈{C,D,E,F}, no change to X.
fifth time: FD CF→B, C,F∈{C,D,E,F}, add B to X, X = {B,C,D,E,F}
Since X={B,C,D,E,F} and Xold={C,D,F}, loop second time:
Set Xold={B,C,D,E,F}
Execute for each loop
first time: FD BC→D, no change to X.
second time: FD D→E, no change to X.
third time: FD AB→C, A,B not∈{B,C,D,E,F}, no change to X.
fourth time: FD BC→A, B,C∈{B,C,D,E,F}, add A to X. X = {A,B,C,D,E,F}
fifth time: FD CF→B, no change to X.
Since X={A,B,C,D,E,F} and Xold={B,C,D,E,F}, loop third time:
No change in X, so closure of {C,D,F} is X={A,B,C,D,E,F}