Skip to content
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

Closed

Conversation

syedjahangirpeeran
Copy link

Fixes #12 .

@syedjahangirpeeran
Copy link
Author

@sahilbansal17 review my code as part of GSSoC.

@syedjahangirpeeran
Copy link
Author

Fixes #11 Weighted Job Scheduling.

@syedjahangirpeeran syedjahangirpeeran changed the title Added UVa Maximum Sub-sequence Product Solution Added UVa Maximum Sub-sequence Product Solution and Weighted Job Scheduling. Jun 23, 2018
@syedjahangirpeeran
Copy link
Author

@sahilbansal17 Please go through it so that I can start solving others issues.

Copy link
Owner

@sahilbansal17 sahilbansal17 left a 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?

@syedjahangirpeeran
Copy link
Author

Done

@syedjahangirpeeran syedjahangirpeeran changed the title Added UVa Maximum Sub-sequence Product Solution and Weighted Job Scheduling. Added Strassen's Algorithm and Weighted Job Scheduling. Jun 23, 2018
@syedjahangirpeeran
Copy link
Author

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) {
Copy link
Owner

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>
Copy link
Owner

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)
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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);
Copy link
Owner

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.
Copy link
Owner

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}};
Copy link
Owner

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.
Copy link
Owner

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.

@sahilbansal17
Copy link
Owner

@syedjahangirpeeran Please make the requested changes.

@sahilbansal17 sahilbansal17 self-assigned this Jun 26, 2018
@sahilbansal17
Copy link
Owner

@syedjahangirpeeran This PR would be closed if there is no longer any response from your side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants