We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You are being asked to answer whether two sets meets a definition (bijection). Your first set are your x values, these are your inputs to the function. So say the function is f(x)= x^2, the first set is the values of x say (1,2,3). The second set is your ouput. So in this case (1^2, 2^2, 3^2) = (1,4,9). Again the two sets are (1,2,3) and (1,4,9). Now the question asks how do you know if this a bijection. A bijection means that each value x corresponds to a unique value y and each value y corresponds to a unique value x. So 1 -> 1, 2 -> 4, 3->9. So this set is a bijection. Sets that wouldn't be bijections are (1,2,3,5) -> (1,4,9) x value 5 does not correspond to any value y, (1,2,3) -> (1,4,9,16) y value 16 does not correspond to any x value, (1,1,3) -> (4,2,3) 1 value x corresponds to multiple y values, (4,2,3) -> (1,1,3) 1 value corresponds to multiple x values.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Security Bijective Functions
You are viewing a single comment's thread. Return to all comments →
You are being asked to answer whether two sets meets a definition (bijection). Your first set are your x values, these are your inputs to the function. So say the function is f(x)= x^2, the first set is the values of x say (1,2,3). The second set is your ouput. So in this case (1^2, 2^2, 3^2) = (1,4,9). Again the two sets are (1,2,3) and (1,4,9). Now the question asks how do you know if this a bijection. A bijection means that each value x corresponds to a unique value y and each value y corresponds to a unique value x. So 1 -> 1, 2 -> 4, 3->9. So this set is a bijection. Sets that wouldn't be bijections are (1,2,3,5) -> (1,4,9) x value 5 does not correspond to any value y, (1,2,3) -> (1,4,9,16) y value 16 does not correspond to any x value, (1,1,3) -> (4,2,3) 1 value x corresponds to multiple y values, (4,2,3) -> (1,1,3) 1 value corresponds to multiple x values.