Interval Partitioning

Published , Updated

The following post is derived from notes taken while reading through this textbook .

Assumptions and Statements:


Algorithm - intPartSchedule(Job[] jobs)

Input - An array of jobs to be scheduled.

Output - A list of processors containing the scheduled jobs.

        Sort the jobs by their ending times from earliest to latest end time.
        The first job to end will be at the beginning of the array.
        The last job to end will be at the end of the array.

        // Initialize the processor list and add the first processor to it.
        List<Processor> processors = new ArrayList<>();
        processors.add(new Processor());

        for (i = 0 to jobs.length)
            for (k = 0 to processors.length)
                if (job[i] is compatible with processors.get(k))
                    // Create a new processor, then add the job to the
                    // last processor in the list as that is the new processor.
                    processors.add(new Processor())

        return processors