Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ UNIC 6. In a two dimensional array, suppose indices represent people and that the value at row l, column j of a the array

C++ image text in transcribed
UNIC 6. In a two dimensional array, suppose indices represent people and that the value at row l, column j of a the array is true just in case i and j are friends and false otherwise. Initialized your array to represent the following configuration: 2 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, so in the example above there are 6 pairs of friends. 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 i, j. The method should return true if there is an integer k such that i is a friend of k and k is a friend of j and return false otherwise. Test this function in the main() program. b) (20 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Complete YOUR ANSWER HERE and # your code here

Answered: 1 week ago

Question

4. Identify the challenges facing todays organizations

Answered: 1 week ago