Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

activity selection java solution

public static void printMaxActivities(int s[], int f[], int n)
    {
    int i, j;
      
    System.out.print("Following activities are selected : n");
    i = 0;
    System.out.print(i+" ");
    for (j = 1; j < n; j++)
    {
         if (s[j] >= f[i])
         {
              System.out.print(j+" ");
              i = j;
          }
     }
    }
Source by www.interviewbit.com #
 
PREVIOUS NEXT
Tagged: #activity #selection #java #solution
ADD COMMENT
Topic
Name
1+9 =