Showing posts with label Job Sequencing With Deadline. Show all posts
Showing posts with label Job Sequencing With Deadline. Show all posts

Thursday, April 14, 2011

Job Sequencing With Deadline


import java.io.*;
class job
{
        static void JS(int d[],int j[],int n,int p[])throws IOException
        {
                        int profit=0;
                        j[1]=1;
                     int              k=1,r;
                        for(int i=1;i<=n;i++)
                        {
                                         r=k;
                                        while((d[j[r]]>d[i]) && (d[j[r]]!=r))
                                        r=r-1;
                                        if(d[j[r]]<=d[i] && d[i]>r)
                                        {
                                                        for(int q=(k);q>=(r+1);q--)
                                                        {
                                                                        if(q==-1)
                                                                        break;
                                                        j[q+1]=j[q];
                                            }
                                                        j[r+1]=i;
                                                        k=k+1;
                                        }
                        }