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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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