Tag

Greedy

Browsing

An activity-selection is the problem of scheduling a resource among several competing activity. It is a mathematical optimization problem concerning the selection of non-conflicting activities to perform within a given time frame, given a set of activities each marked by a start time and finish time.

A job scheduler is a computer application for controlling unattended background program execution. Write a program to implement task scheduling problem which will schedule the tasks? source Code package com.dsacode.Algorithm.greedy; import java.util.Arrays; class Job implements Comparable < Job > { public char id; public Integer dead; public int profit; public Job(char a, int i, Integer k) { id = a; dead = i; profit = k; } public int compareTo(Job o) { return this.dead.compareTo(o.dead); } }; public class TaskSheduling { static void printJobScheduling(Job arr[], int n) { Arrays.sort(arr); int[] result = new int[n]; boolean[] slot = new boolean[n]; for (int…