1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nikolay [14]
3 years ago
6

My friend Leo wants to have an emergency plan for his final exams on University of Southern Algorithmville. He has N subjects to

prepare for, and for each subject, his score is determined only by the time he spends on learning. It’s not surprising that Leo found out he actually spent zero time on preparing before.At least he knows when he can start learning all of these subjects. For each subject i there is a start time si when he can get all materials ready to start learning. And there is also a ending time ei for each subject, when his learning materials expire and he can’t learn anymore. We know that si and ei are integers, and Leo can only dedicate to a single subject within each time phase.In Universtiy of Southern Algorithmville (USA), a student’s total grade is the minimum grade among all subjects. Leo wants you to help him find out the best outcome. Given N subjects and their time intervals (si,ei), design an algorithm to find out the maximum time possible for the least prepared subject. Prove the correctness of your algorithm. (Hint: It’s not enough to use the network flow algorithm alone to determine the answer.)
Computers and Technology
1 answer:
Brut [27]3 years ago
8 0

Answer:

Greedy algorithm

Explanation:

Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. Greedy algorithms are used for optimization problems. An optimization problem can be solved using Greedy if the problem has the following property: At every step, we can make a choice that looks best at the moment, and we get the optimal solution of the complete problem.

If a Greedy Algorithm can solve a problem, then it generally becomes the best method to solve that problem as the Greedy algorithms are in general more efficient than other techniques like Dynamic Programming. But Greedy algorithms cannot always be applied. For example, the Fractional Knapsack problem (See this) can be solved using Greedy, but 0-1 Knapsack cannot be solved using Greedy.

The following are some standard algorithms that are Greedy algorithms.

1) Kruskal’s Minimum Spanning Tree (MST):

In Kruskal’s algorithm, we create an MST by picking edges one by one. The Greedy Choice is to pick the smallest weight edge that doesn’t cause a cycle in the MST constructed so far.

2) Prim’s Minimum Spanning Tree:

In Prim’s algorithm also, we create an MST by picking edges one by one. We maintain two sets: a set of the vertices already included in MST and the set of the vertices not yet included. The Greedy Choice is to pick the smallest weight edge that connects the two sets.

3) Dijkstra’s Shortest Path:

Dijkstra’s algorithm is very similar to Prim’s algorithm. The shortest-path tree is built up, edge by edge. We maintain two sets: a set of the vertices already included in the tree and the set of the vertices not yet included. The Greedy Choice is to pick the edge that connects the two sets and is on the smallest weight path from source to the set that contains not yet included vertices.

4) Huffman Coding:

Huffman Coding is a loss-less compression technique. It assigns variable-length bit codes to different characters. The Greedy Choice is to assign the least bit length code to the most frequent character.

The greedy algorithms are sometimes also used to get an approximation for Hard optimization problems. For example, the Traveling Salesman Problem is an NP-Hard problem. A Greedy choice for this problem is to pick the nearest unvisited city from the current city at every step. These solutions don’t always produce the best optimal solution but can be used to get an approximately optimal solution.

You might be interested in
Vkq-jnfi-uif se-x fun girls joi-n mee-t usin-g this cod_e​
liberstina [14]

Answer:

Why?

Explanation:

7 0
3 years ago
When we type there Is blue like thing blinking what's that called ​
taurus [48]

Answer:

a cursor? I think.

3 0
3 years ago
Read 2 more answers
Your company shares a building with a competitor's branch office. Recently, you noticed that some computers other than company c
professor190 [17]

<u>The wireless network:</u>

Wireless networking and internet access are essentials when it comes to the smooth functioning of an enterprise. Certain information can be transferred from one computer to another within a specified if they are connected to a network.

In this case, as the company shares the building with the branch office of a rival company there may be repercussions. First of all, the company's wireless network should be equipped with a strong password and it should be changed regularly too.

Next, the officials responsible for networking should also monitor the range of their wireless network. There is no point in keeping the range of wireless network wide as it is to be used by employees only and they can access it on the company's premises.

5 0
3 years ago
Read the data file to a data frame ss16wa, and only retain columns "PWGTP", "AGEP", "WAGP", "VALP", "WKHP", "CIT", "ACCESS". (2)
Murrr4er [49]

Answer:

Data Frame

A data frame is used for storing data tables. It is a list of vectors of equal length. For example, the following variable df is a data frame containing three vectors n, s, b.

> n = c(2, 3, 5)

> s = c("aa", "bb", "cc")

> b = c(TRUE, FALSE, TRUE)

> df = data.frame(n, s, b)       # df is a data frame

Built-in Data Frame

We use built-in data frames in R for our tutorials. For example, here is a built-in data frame in R, called mtcars.

> mtcars

              mpg cyl disp  hp drat   wt ...

Mazda RX4     21.0   6  160 110 3.90 2.62 ...

Mazda RX4 Wag 21.0   6  160 110 3.90 2.88 ...

Datsun 710    22.8   4  108  93 3.85 2.32 ...

              ............

The top line of the table, called the header, contains the column names. Each horizontal line afterward denotes a data row, which begins with the name of the row, and then followed by the actual data. Each data member of a row is called a cell.

To retrieve data in a cell, we would enter its row and column coordinates in the single square bracket "[]" operator. The two coordinates are separated by a comma. In other words, the coordinates begins with row position, then followed by a comma, and ends with the column position. The order is important.

Explanation:

4 0
3 years ago
Marie and Jean-Pierre want to share their work with each other easily to collaborate on a school project. What is the BEST way f
Sedbober [7]

Answer:

Upload the files to an online storage application and give both of them access

Explanation:

Multiple individuals can collaborate on a common files by uploading the shared documents to an online repository and providing access credentials to the documents to both the individuals. The two individuals, Marie and Jean-Pierre in this case, can then take turns to contribute their portion of school project until it gets to the final state ready for submission.

7 0
3 years ago
Other questions:
  • Create a funtion makeStudent(studentlist) where studentlist is your list of Student namedtuples The function should do the follo
    13·1 answer
  • What inventor patented the first american movie projector
    15·2 answers
  • c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
    5·1 answer
  • Edhesive coding practice 3.4​
    12·1 answer
  • Explain how touch-tone dialing sends digits to the switch and write the name given to define touch-tone dialing.
    10·1 answer
  • analyze the ethical issues in the use of information technology in Multinational company (MNC) and support you answer with one e
    15·1 answer
  • To ensure that comments identify the initials of the person making changes, you would need to _____.
    5·2 answers
  • Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not
    10·1 answer
  • What job does a front-end developer perform?
    15·1 answer
  • Which of the following statements are TRUE about formatting images in HTML.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!