-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Strassen's Algorithm and Weighted Job Scheduling. #30
Added Strassen's Algorithm and Weighted Job Scheduling. #30
Conversation
@sahilbansal17 review my code as part of GSSoC. |
Fixes #11 Weighted Job Scheduling. |
@sahilbansal17 Please go through it so that I can start solving others issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please elaborate a little on the complexity of your algorithm through comments at the end of the program?
Done |
Added #38 . |
#include<stdio.h> | ||
#define ll long long int | ||
using namespace std; | ||
void sumsub(vector< vector<ll> > &A, vector< vector<ll> > &B, vector< vector<ll> > &C, ll m, char s) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write appropriate comments what each function does and also follow the naming conventions as mentioned in the Coding standards wiki page
@@ -0,0 +1,129 @@ | |||
#include <bits/stdc++.h> | |||
#include <vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need of additional header files, if you have already included "bits/stdc++.h"
} | ||
return 0; | ||
} | ||
//From Master's Theorem, time complexity is O(N^Log7) which is approximately O(N^2.8074) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please elaborate more on this part, what is the recurrence relation and how exactly it came up.
|
||
int main(){ | ||
ll t ,i ,j ,k, q ,n; | ||
cin>>t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please enter appropriate cout statements as prompt for the user to know what is being taken as input!
for(i=0;i<n;i++){ | ||
for(j=0;j<n;j++){ | ||
scanf("%lld",&q); | ||
A[i][j]=q; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the Coding standards with appropriate spacing.
ll t ,i ,j ,k, q ,n; | ||
cin>>t; | ||
for(k=0;k<t;k++){ | ||
scanf("%lld",&n); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use both cin and scanf statements in the same program. Use either of them.
return (s2.finish > s1.finish); | ||
} | ||
|
||
int binarySearch(Job jobs[], int index){// to find the latest job (before current job) that doesn't conflict with current job. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow to Coding standards for comments. Comments should be above the code statements.
} | ||
|
||
int main(){ | ||
Job array[] = {{1, 2, 150}, {5, 10, 80}, {3, 11, 20}, {2, 50, 300}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take input from user with appropriate prompts using cout.
cout << "Maximum profit obtained is " << findMaxProfit(array, n); | ||
return 0; | ||
} | ||
// The complexity of this algorithm is O(nLogn) as it uses Binary Search. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elaborate on the complexity. Add atleast a few lines making it more clear.
@syedjahangirpeeran Please make the requested changes. |
@syedjahangirpeeran This PR would be closed if there is no longer any response from your side. |
Fixes #12 .