Skip to content

Commit 9f97728

Browse files
Algorithms
1 parent aea7707 commit 9f97728

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Algorithms.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ bool compare(T x, T y)
4040
return x > y ? true : false;
4141
}
4242

43+
bool pair_Compare(const pair<int, int>&a, const pair<int, int>&b)
44+
{
45+
return a.second < b.second;
46+
}
47+
4348
int main()
4449
{
4550

@@ -233,6 +238,18 @@ int main()
233238
cout<<s.substr(6)<<endl;
234239
cout<<s.substr(3, 9)<<endl;
235240
*/
241+
242+
// Max Occuring Element in a C++ Map.
243+
244+
/*
245+
map<int, int> Map;
246+
Map[100] = 7;
247+
Map[200] = 9;
248+
Map[300] = 1;
249+
250+
cout<<"Key : "<<max_element(Map.begin(), Map.end(), pair_Compare)->ff<<endl;
251+
cout<<"Value : "<<max_element(Map.begin(), Map.end(), pair_Compare)->ss<<endl;
252+
*/
236253

237254
return 0;
238255
}

0 commit comments

Comments
 (0)