Write a method called select_set

Assignment Help JAVA Programming
Reference no: EM131223431

Twitter is a popular social media platform for users to send out a short message (a "tweet") to other users who are registered as his/her followers. Figure 1 shows a graph. (The topic on graphs will be covered after your term break, and you are not required to understand graphs for this lab; it's a very useful illustration for this scenario nonetheless).

945_Figure.png

The circles labeled "0", "1", "2" etc. are called nodes (or vertices) of the graph, and the arrows connecting the nodes are called edges. This graph shows a small network of Twitter users with the nodes representing users, and the edges show which user is following which other users: an arrow means "is following" (and not "is followed by"). The graph in figure 1 can hence be interpreted as a network of 11 tweeter users (users 0, 1, 2... 10). Users 0 and 3 are following 1, 1 is following 2, 3 and 4, 2 is following 0 and 3, and so on. By studying this simple graph, it should be obvious that user 3 has the most number of followers (four followers), and is hence the most influential user since a tweet initiated by user 3 will be received by four users.

We would like to start a viral marketing campaign. The approach is to select five Twitter users, and pay them to tweet an advertisement. The problem is to identify which five users to select so that we will reach as many unique followers as possible.

For simplicity, assume that Tweeter user IDs are sequential numbers starting from 0. So if there are 11 users, their user IDs will be 0, 1, 2... 10. The Tweeter graph above can be represented in the form of a table like this:

User ID

Direct Follower User IDs

0

2

1

0, 3

2

0, 1

3

1, 2, 4, 5

4

1, 6, 10

5

 

6

7, 8

7

 

8

 

9

8

10

9

Instead of selecting only five Tweeter users to send the advertisement, management has approved a budget to pay many more Tweeter users to send the advertisement. However this time round, management wants EVERY user to get the message. So, the new goal for you is to select the smallest number of Tweeter users who need to send the advertisement so that everyone will get it.

Requirements:

Write a method called select_set that takes in 1 parameter: followers (a 2D array of Tweeter users) and returns the user IDs of any number of users (as an array of integers) selected by your algorithm who will be selected to broadcast the advertisement. followers.length will give you the total number of Tweeter users in the Tweeter universe.

The objective is to make select_set as small as possible such that every user gets the advertisement.

Your solution will be checked using this method: all_users_got_message?. This method takes in your array of selected tweeters (selected) and the original followers 2D array, and returns true (if every Tweeter user would have gotten the message) or false (if at least one Tweeter user hasn't gotten the message). If all_users_got_message?istrue, your solution's quality will depend on the number of users in your selected set (selected.length).

Attachment:- Project Assignment.rar

Reference no: EM131223431

Questions Cloud

Describe the long run impact on inflation and output : Describe the long-run impact on inflation and output if the central bank implicitly allows its inflation target to rise.
Journalize all entries to income statements-balance sheet : Company Z sells annual subscription to their online magazine. Clients must pay a year subscriptions in advance. Company Z has a policy to prepare reversing entries when possible. It is also their policy to journalize all entries to income statements/..
How the economy could fall into a deflationary spiral : Explain in terms of the aggregate demand-aggregate supply framework how the economy could fall into a deflationary spiral if it were hit by a negative aggregate demand shock.
Person indifferent between these two investments : A person plans to save $1 for 20 years. They can invest at an annual rate of 10% (r=0.1). This investment opportunity "compounds annually" (meaning that they receive interest payments at the end of each year). For what value of  r~ is the person indi..
Write a method called select_set : Write a method called select_set that takes in 1 parameter: followers (a 2D array of Tweeter users) and returns the user IDs of any number of users (as an array of integers) selected by your algorithm who will be selected to broadcast the advertis..
What would be the likely consequences for inflation : If the central bank bases its policy decisions on the consensus forecast, - what would be the likely consequences for inflation assuming it maintains its existing inflation target?
Which is incorporated in the state of alpha : You are the 100% owner of X Corporation, which is incorporated in the state of Alpha and has its principal place of business there. Your company has 5 employees, including you, and does computer consulting services for small businesses. You do all of..
Which page that first appears once you logged into grantham : Start each search from the GLife home page within Grantham's website, which is the page that first appears once you've logged into Grantham, and then tell me exactly which items you clicked on and where they were located until you got to your fina..
Would you anticipate the bank lending channel : In the wake of the financial crisis of 2007-2009, would you anticipate the bank lending channel becoming more or less important in the United States in the near future?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Convert the while loop

Convert the while loop in the following code segment to a do-while loop

  Write a recursive method to compute the following series

Write a recursive method to compute the following series.

  Information systems to strengthen customer

Which of the following illustrates the use of information systems to strengthen customer and supplier intimacy? BPM is considered concluded when the new processes are both implemented and accepted.

  Draw a scheduling chart to show how the i/o and cpu

Draw a scheduling chart to show how the I/O and CPU are allocated and compute the average turnaround times for the CPU-bound and I/O bound task. Use the following table to keep track of all events and Ready/Blocked (I/O) queues.

  Cognitive-based approaches to understanding motivation

Compare and contrast the need-based and cognitive-based approaches to understanding motivation?

  String that contains at least five letters

Write an application that prompts the user for a String that contains at least five letters and at least five digits. Continuously reprompt the user until a valid String is entered. Display a message indicating whether the user was successful or did ..

  Physical address and a virtual address

What is the difference between a physical address and a virtual address?

  Print out each word of the input sentence to a separate line

After this, create another program that could be used to take the words in words.txt and recreate the original sentence - this time printing the result to the screen. Please write well commented code.

  Develop a java application to calculate the monthly paycheck

Develop a Java application to calculate the monthly paychecks for a number of different types of employees. The employee types are created in a subclass array based on parent base class Employee. Does this ring a bell?

  Programming exercises

Programming Exercises 1. Write an application named BadSubscriptCaught in which you declare an array of 10 first names. Write a try block in which you prompt the user for an integer and display the name in the requested position.

  Create an array of objects of the sub-class

Create an array of objects of the sub-class. Add two objects to the array. Loop through the array and print what each element is constructed from.

  Implement a singly linear linked list

Prepare a C++ using visual studios program to implement a singly linear Linked List - You need to implement singly link list in C++.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd