-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASS_B_3
55 lines (42 loc) · 1.29 KB
/
ASS_B_3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
########################################################################################################################
problem statement:-Implement a problem of minimum work to be done per day to finish given tasks within D days problem.
Statement: Given an array task[] of size N denoting amount of work to be done for each task, the problem is to find the
minimum amount of work to be done on each day so that all the tasks can be completed in at most D days. Note: On one day
work can be done for only one task.
Input: task[] = [3, 4, 7, 15], D = 10
Output: 4
Input: task[] = [30, 20, 22, 4, 21], D = 6
Output: 22
#########################################################################################################################
#include<iostream>
using namespace std;
void qsort(int arr[],int s,int e)
{
if(s<e)
{
int i=s-1,temp;
for(int j=s;j<e+1;j++)
{
if(arr[j]>=arr[e])
{
i++;
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
qsort(arr,s,i-1);
qsort(arr,i+1,e);
}
}
int main()
{
int arr[]={8,2,0,7,0,0,1},s=0;
int e=(sizeof(arr)/4)-1;
qsort(arr,s,e);
for(int i=0;i<7;i++)
{
cout<<arr[i]<<" ";
}
return 0;
}