Menu

Unic 6 Two Dimensional Array Suppose Indices Represent People Value Row Column Array True Q43889238

c++
UNIC 6. In a two dimensional array, suppose indices represent people and that the value at row column of a the array is TRUE(UNIC 6. In a two dimensional array, suppose indices represent people and that the value at row column of a the array is TRUE(1) In case i and jare friends and FALSE(0) otherwise. Initialize your array to represent the following configuration: 0 1 2 3 4 21 3 | . a) Write the code that counts how many pairs of friends are represented in the array. Note that each friendship pair appears twice in the array (0 and 1 are friends but als O are friends). So in the example above there are actually only 6 pairs of friends. b) Write a function to check whether two people have a common friend. For example, in the example above, 0 and 4 are both friends with 3 (so they have a common friend), whereas 1 and 2 have no common friends. The method should have three parameters: a 2D array of boolean representing the friendship relationships and two integers ij. The method should return true if there is a k such that i is a friend of k and k is a friend of and return false otherwise. Test this function in the main() program. (20 points) Show transcribed image text UNIC 6. In a two dimensional array, suppose indices represent people and that the value at row column of a the array is TRUE(1) In case i and jare friends and FALSE(0) otherwise. Initialize your array to represent the following configuration: 0 1 2 3 4 21 3 | . a) Write the code that counts how many pairs of friends are represented in the array. Note that each friendship pair appears twice in the array (0 and 1 are friends but als O are friends). So in the example above there are actually only 6 pairs of friends. b) Write a function to check whether two people have a common friend. For example, in the example above, 0 and 4 are both friends with 3 (so they have a common friend), whereas 1 and 2 have no common friends. The method should have three parameters: a 2D array of boolean representing the friendship relationships and two integers ij. The method should return true if there is a k such that i is a friend of k and k is a friend of and return false otherwise. Test this function in the main() program. (20 points)

Expert Answer


Answer to UNIC 6. In a two dimensional array, suppose indices represent people and that the value at row column of a the array is …

OR