Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Consider the Linkedln solution that allows people to connect on a social media platform for employment purposes. Every user on Linkedln can establish one

c++

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Consider the Linkedln solution that allows people to connect on a social media platform for employment purposes. Every user on Linkedln can establish one or more connections with other users on the same platform. In addition to the connections, assume that Linkedln also tracks and saves the employer company of each user. Consider the following example. Write a function that allows a user to discover how connected he/she is to some company. The function targets a specific input company and prints how far the user is in his connections from that company, and how many users he is connected to from that company at that level. For instance, if Khaled likes to know how much he is connected to the STS company, the answer will be 2 (for the shortest distance to STS) and 2 (for the number of users at that distance working at STS). Another example, if Khaled likes to know how much he is connected to PSUT, the answer will be 1 for the distance and 2 for the number of users, as two users are directly connected to him from PSUT (Sara and Firas) Input N for the number of users, C for the number of connections between these users An array for the names of the users with names [0] as the name of the first user and so on. An array for the companies with companies [0] as the company of the first user and so on. An array of integers for the From values of the connections, assuming 0 based arrays An array of integers for the To values of the connections, assuming 0-based arrays A user Name as a string A Target Company as a string Output Your function should print how far is the Target Company for the given user name, and how many users exist at that level. if not connected, it should print "Not Connected" Note: The program will be automatically tested by calling your HowConnected(int N, int C, string names[], string companies[], int from[], int to [], string name, string targetcompany) function. You are not allowed to change the signature of this function but you can expand your file and functions/classes as needed. Example 1: Input: N=8C=10 From and To Arrays 01 02 - 7 14 23 25 36 47 56 67 Names: Omar Tuqa Aesha Ahmad Ali Salem Sara Firas Companies: A C Example 2: For the same input above but with Name: Omar Target Company: C answer: 13

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

Students also viewed these Databases questions