There is a very simple greedy algorithm(Pseudocode) that maximizes your total reward. Find it.
Consider the following scheduling problem. Each task I has a length L[I] and a deadline D[I].
There is a single processor that handles one task at a time. Let E[I] be the ending time of I under a given schedule.
You get paid an amount D[I] − E[I] if you finish task I early and you get fined an amount E[I] − D[I] if you finish task I late.
Greedy Approach:
Sort all tasks in ascending order of their length
consider an array of tasks Tasks[I] sort it
for(task t : allTasks)
{
process smallest length task
calculate profit
smallest length task will be farthest from the deadline and will earn more profit
}
since we kept picking task which gives more profit initially(irrespective of final result) this approach is greedy.
There is a very simple greedy algorithm(Pseudocode) that maximizes your total reward. Find it. Consider the...
16. Consider a single-processor system that uses the round-robin (RR) process scheduling algorithm. Assume that the time quantum is 10 milliseconds. Consider the five processes with the arrival time and the burst time, in milliseconds, shown in the table below Arrival Time Burst Time (milliseconds) (milliseconds) Process Pl P2 P3 P4 P5 0 24 20 23 24 Which of the five processes is the last to finish its execution? (A) P (B) P2 (C) P3 (D) P4 (E) P5
Need in pseudocode
Program 2: POWIN3D. In the early 80s, hackers used to write in an obfuscated, but mostly readable way called "leet" - short for "elite". In essence, it was a simple character replacement algorithm, whereya single "regular" character was replaced by one or more "leet" characters; numbers remained the same. Here's one of the most readable versions: g9m AS$y 00u | |р | P v II 9 IQ W LrRXI>< VI Note! You will need to know how...
Program 2: P0\/\/|\|3D. In the early 80s, hackers used to write in an obfuscated, but mostly readable way called “leet” – short for “elite”. In essence, it was a simple character replacement algorithm, where a single “regular” character was replaced by one or more “leet” characters; numbers remained the same. Here’s one of the most readable versions: a 4 g 9 m /\\/\\ s $ y ‘/ b B h |-| n |\\| t 7 z Z c ( i...
Please help me with this answer. Performance Comparison for Dijkstra Algorithm and Bellman-Ford Algorithm Problem Description The shortest path problem is one of most important problems in graph theory and computer science in general. Shortest path problem is one of typical optimization problems. Given a graph G = (V,E), the goal is to nd a minimum cost path from s → t, s,t ∈ V . This variant is called one-to-one shortest path problem. Other variants are one-to-all (compute shortest...
C++ SOURCE CODE P0\/\/|\|3D. In the early 80s, hackers used to write in an obfuscated, but mostly readable way called “leet” – short for “elite”. In essence, it was a simple character replacement algorithm, where a single “regular” character was replaced by one or more “leet” characters; numbers remained the same. Here’s one of the most readable versions: a 4 g 9 m /\\/\\ s $ y ‘/ b B h |-| n |\\| t 7 z Z c (...
For this assignment, your job is to create a simple game called
Opoly.
The objectives of this assignment are to:
Break down a problem into smaller, easier problems.
Write Java methods that call upon other methods to accomplish
tasks.
Use a seed value to generate random a sequence of random
numbers.
Learn the coding practice of writing methods that perform a
specific task.
Opoly works this way: The board is a circular track of variable
length (the user determines the...
SMTP Your task is to develop a simple mail client that sends email to any recipient. Your client will need to connect to a mail server, dialogue with the mail server using the SMTP protocol, and send an email message to the mail server. Python provides a module, called smtplib, which has built in methods to send mail using SMTP protocol. However, we will not be using this module in this lab, because it hide the details of SMTP and...
This is java and make simple program. CPSC 1100. Thanks
CSPS 1100 Lab 4 ay total Also I would need a new name for the daubles. An example here might be double tRtalD-caradd xD, YD) 1. (a) We are going to begin with some simple math, reading input, and formatted output. Create a class called MuCalsustec Yau will not have an instance variable. Since you have no instance variables to initialize, you do nat need a constructar. Do NOT create...
C++ HW Question Your program will simulate a simple change maker for a vending machine. It will start with a stock of coins and dollars. It will then repeatedly request the price for an item to be purchased or to quit. If given a price, it will accept nickels, dimes, quarters, one-dollar and five-dollar bills—deposited one at a time—in payment. When the user has deposited enough to cover the cost of the item, the program will calculate the coins to...
build a bank simulator system using the C++ STL queue library.
You are required to create your
own ADT for that system that:
First, Read from a file the data of incoming customers which
includes
ArrivalID, StartTime, and ProcessTime.
You have one line in your Bank in which you will serve your
customers as per to their arrival time.
For example if you read the following data from the file
A 1 5
B 2 5
C 4 5
D...