From cfda5253cc519b3e88b3e445717318f10ba44ea3 Mon Sep 17 00:00:00 2001 From: Arnab Chatterjee Date: Mon, 11 Jul 2022 23:18:54 +0530 Subject: [PATCH 1/3] Delete README.md --- README.md | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 0f36214..0000000 --- a/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Competitive Programming Assignment - -Solve the following problems: -1. Given an array of size n arrange the array in such a way that all even numbers comes before all odd numbers and the order should be maintained -Example - 13 25 6 24 45 2 -Output - 6 24 2 13 25 45 - - -2. Given an array of size n print the array element and it's frequency. (Order not mandatory) -Example - 2 4 2 2 3 3 3 5 -Output: -2 - 3 -3 - 3 -4 - 1 -5 - 1 - -# Instructions to upload - -- Fork the repository -- Create a new branch (with your name) -- Upload files in the new branch. -- Create a pull request. - From b03e256b8cdff26f193c93cf7beba617062a577e Mon Sep 17 00:00:00 2001 From: Arnab Chatterjee Date: Mon, 11 Jul 2022 23:19:51 +0530 Subject: [PATCH 2/3] Create README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f66cc69 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +Arnab Chatterjee +B.tech CSE AI +1st year +F4 +211003003032 From f060ab2e00371835e89b5c40cc09e3d87d4067f1 Mon Sep 17 00:00:00 2001 From: Arnab Chatterjee Date: Mon, 11 Jul 2022 23:22:16 +0530 Subject: [PATCH 3/3] First Day submission --- first.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ second.cpp | 21 +++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 first.cpp create mode 100644 second.cpp diff --git a/first.cpp b/first.cpp new file mode 100644 index 0000000..b0807b6 --- /dev/null +++ b/first.cpp @@ -0,0 +1,77 @@ +#include +#include +using namespace std; + +vector makeArray(int n) +{ + vector ar; + for(int i=0;i> t; + ar.push_back(t); + } + cout << endl; + + return ar; +} + +void usingTime(vector arr,int n) +{ + for(int i=0;i arr,int n) +{ + vector even,odd; + + for(int i=0;i> n; + vector arr = makeArray(n); + + //approch using time complexity O(n^2) + usingTime(arr,n); + + // approch using space complexity O(n) + usingSpace(arr,n); + + return 0; +} \ No newline at end of file diff --git a/second.cpp b/second.cpp new file mode 100644 index 0000000..c67535d --- /dev/null +++ b/second.cpp @@ -0,0 +1,21 @@ +#include +#include +#include +#define rep(i,a,b) for(int i=a;i> n; + vector arr; + unordered_map m; + rep(i,0,n) {int temp; cin >> temp; arr.push_back(temp);} + rep(i,0,n) m[arr[i]]++; + unordered_map ::iterator it = m.begin(); + while(it!=m.end()){ + cout << it->first << "-" << it->second << endl; + it++; + } + return 0; +} \ No newline at end of file