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

1st pull request #274

Open
wants to merge 576 commits into
base: master
Choose a base branch
from
Open

1st pull request #274

wants to merge 576 commits into from

Conversation

fantom787
Copy link

#include <bits/stdc++.h>
using namespace std;

void SelectActivities(vectors,vectorf){

vector<pair<int,int>>ans;

priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>p;

for(int i=0;i<s.size();i++){
	p.push(make_pair(f[i],s[i]));
}

auto it = p.top();
int start = it.second;
int end = it.first;
p.pop();
ans.push_back(make_pair(start,end));

while(!p.empty()){
	auto itr = p.top();
	p.pop();
	if(itr.second >= end){
		start = itr.second;
		end = itr.first;
		ans.push_back(make_pair(start,end));
	}
}
cout << "Following Activities should be selected. " << endl << endl;

for(auto itr=ans.begin();itr!=ans.end();itr++){
	cout << "Activity started at: " << (*itr).first << " and ends at " << (*itr).second << endl;
}

}

int main()
{
vectors = {1, 3, 0, 5, 8, 5};
vectorf = {2, 4, 6, 7, 9, 9};
SelectActivities(s,f);

return 0;

}

Mustafiz04 and others added 30 commits October 15, 2020 17:43
Maximum_Depth_of_N-ary_Tree.java
Kth_Smallest_Element_in_a_BST.java
Added Hello World in Assembly
Equal Sum Partition of an array
added sublist_search algorithm
Minimum no of deletions to make string palindrome
longest common subsequence print
A single Python Project that show implementation of a single neuron
added countingsort algorithm
added cyclesort algorithm
sum of n natural number
added a wallpaperchanger for windows10
added two cpp files in Data Structures
rotate matrix code in c++ added
Mustafiz04 and others added 30 commits October 14, 2021 23:49
Added DatabaseConnectivity.java
Create palindrome_partitioning.py
Create MedianOfTwoSortedArrays.java
Added Data Analytics project Folder
Create alphabet_triangle.cpp
PreOrder Trvaversal of Tree.
Longest_Common_Subsequence
Create SumofNaturalnumbers.java
clean and concise code
A basic CSS Animation
Create generate_paranthesis.cpp
Added files to a new PYTHON folder that is created by me
Create FloydWarshall-algorithm.cpp
Github User id : AswinAzikar 
#hacktoberfest 2021
Github User id : AswinAzikar 
#hacktoberfest 2021
Assembly program to find lcm of two numbers
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