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]
2 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]2 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
In a five-choice multiple-choice test, which letter is most often the correct
tatiyna

I believe the answer is C.

5 0
2 years ago
Read 2 more answers
1) Put the following in order from smallest to largest A) 1,500,000 bytes B) 2,000 kilobytes C) 0.01 petabytes D) 1 Terabyte E)
Lyrx [107]

Answer:

A, B, E, D, F, C

3 0
2 years ago
SummaryIn this lab, you complete a partially written C++ program that includes a function named multiplyNumbers() that multiplie
Maru [420]

Answer:

Declare the method prototype using:

void multiplyNumbers(int x, int y,int &product);

Call the function using:

multiplyNumbers(num1, num2,product);

Lastly, the method is as follows:

void multiplyNumbers (int x, int y,int &product) {

  product = x * y;

  return; }

Explanation:

Declare the method prototype using

void multiplyNumbers(int x, int y,int &product);

Call the function using

multiplyNumbers(num1, num2,product);

The method is as follows; the & written in front of product implies that product is passed by reference

void multiplyNumbers (int x, int y,int &product) {

This calculate the product

  product = x * y;

This returns nothing

  return; }

<em>See attachment for complete program</em>

Download cpp
5 0
2 years ago
A document format is
anyanavicka [17]

Answer:

A document file format is a text or binary file format for storing documents on a storage media, especially for use by computers. There currently exist a multitude of incompatible document file formats.

Explanation:

8 0
2 years ago
Read 2 more answers
What does a file association specify?
Olenka [21]

Answer:

The answer is D

Explanation:

file association associates a file with an application capable of opening that file. More commonly, a file association associates a class of files with a corresponding application.

4 0
2 years ago
Read 2 more answers
Other questions:
  • In three to five sentences, describe how good e-mail work habits increase workplace efficiency and productivity.
    12·1 answer
  • Corey is an architect. What software does he most likely use to design houses? graphic software scheduling software CAD software
    10·2 answers
  • Over the past week, every time Larry has started his computer, he has noticed that the time is not correct. Larry didn’t conside
    13·2 answers
  • What is the best option for sharing Word documents on a Microsoft network because it provides finer degrees of versioning contro
    6·1 answer
  • Suppose users share a 1-Gbps link. Also, suppose each user requires 200 Mbps when transmitting, but each user only transmits 30
    5·1 answer
  • Ryan would like to copy a list of contacts from a colleague into his personal address book. The list of contacts is
    9·1 answer
  • Q1 To remove filter
    15·2 answers
  • Any please answer this How much resistance is required to gen-erate 50 mA of current from a 5 volt bat-tery?
    5·1 answer
  • Where would you go to access frequently used icons?
    12·2 answers
  • The standard naming convention prefix tag for a query used to identify the object type is?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!