Algorithm # 10 General Algorithm for Testing Loosless Join Decomposition Input: A universal relation R, a decomposition D={R1,R2,...Rm} of R , and a set F of functional dependencies.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

How to code in Python or Java below

 

Algorithm # 10 General Algorithm for Testing Loosless Join Decomposition
Input: A universal relation R, a decomposition D={R1,R2,...Rm}
of R , and a set F of functional dependencies.
1. Create an initial matrix S with one row for each relation Ri
in D, and one column for each attribute Aj in R.
2. Set S(i,j)= bij for all matrix entries.( Note that each bij is
a distinct symbol associated with indices (i,j) ).
3. For each row i representing relation schema Ri
For each column j representing attribute Aj
IF the relation Ri includes attribute Aj then set S(i,j)= aj.
( Note that aj is a distinct symbol associated with index j)
4. Repeat the following loop until a complete loop execution results in no changes to S
For each functional dependency X→Y in F
For all rows in S that have the same symbols in the columns corresponding to
attributes in X.
Make the symbols in each column that correspond to an
attribute in Y be the same in all these rows as follows:
▪ If any of the rows has an “a” symbol for the column,
set the other rows to that same “a” symbol in the column.

▪If no “a” symbol exists for the attribute in any of the rows,

choose one of the “b” symbols that appears in one of the
rows for the attribute and set the other rows to that same “b”
symbol in the column.
5. If a row made up entirely of “a” symbols, then the decomposition has looless join
property ; otherwise , it does not.

 

Please help me to code this.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY