Answered step by step
Verified Expert Solution
Question
1 Approved Answer
whats the python solution to this question? explain the time and space complexity too. Have the function MatrixChallenge ( strArr ) read the strArr parameter
whats the python solution to this question? explain the time and space complexity too.
Have the function MatrixChallengestrArr read the strArr parameter being passed which will make up an NxN matrix where the rows are separated by each pair of parentheses the matrix will range from x to x The matrix represents connections between nodes in a graph where each node corresponds to the Nth element in the matrix with being the first node If a connection exists from one node to another, it will be represented by a if not it will be represented by a For example: suppose strArr were a x matrix with input this means that there is a connection from node and For node the connections are and for node the connections are This can be interpreted as a connection existing from node X to node Y if there is a in the Xth row and Yth column. Note: a connection from XY does not imply a connection from YX What your program should determine is whether or not the matrix, which represents connections among the nodes, is transitive. Atransitive relation means that if the connections and exist for example, then there must exist the connection More generally, if there is a relation xRy and yRz then xRz should exist within the matrix. If a matrix is completely transitive, return the string transitive. If it isn't, your program should return the connections needed, in the following format, in order for the matrix to be transitive: NNNN So for the example above, your program should return You can ignore the reflexive property of nodes in your answers. Return the connections needed in lexicographical order eg
Input Output "transitive"
Input Output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started