




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
this experiment was done in the lab and you should not use this assignment any where I only posted this to get downloading points
Typology: Assignments
1 / 28
This page cannot be seen from the preview
Don't miss anything!
PROBLEM 1:
AIM:
Student Name: Aliasger Shabbirhusein Nazarali UID: 20BCS Branch: CSE Section/Group: 601 A Semester: 5 Subject Code: 20CSP- 314 Subject Name: Competitive Coding- 1
PROGRAM CODE:
#include
using namespace std;
#define MAXE 210
OUTPUT:
PROBLEM 2:
AIM:
return 0;
}
OUTPUT:
PROBLEM 3:
AIM:
return 0;
}
OUTPUT:
PROBLEM 4:
AIM:
cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');
vector
res = pairs(_a,_k); cout << res;
return 0;
}
OUTPUT:
PROBLEM 5:
AIM:
values[i-1].first = values[i-1].second - values[i].second;
} sort(values.begin(), values.end(), [](const pair<int, int>& p1, const pair<int, int>& p2) {
return abs(p1.first) < abs(p2.first); }); auto it = values.begin(); int best = abs(it->first); vector
if (it != best_values.begin()) { cout << " "; } cout << *it; } cout << endl;
}
OUTPUT:
PROGRAM CODE:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
void swap(vector
if(i==j) return; int tmp = arr[i]; arr[i] = arr[j];
arr[j] = tmp;
}
/* Head ends here */
void partition(vector
int boundary =0, i=1, number_of_ele= ar.size(), tmp=0;
while(i<number_of_ele){ if(ar[i] < ar[0]) { tmp = ar[i]; for(int j = i;j>boundary+1;j--){ ar[j] = ar[j-1]; } boundary++; ar[boundary] = tmp; } i++; } int pivot = ar[0]; for(i=0;i<boundary;i++) ar[i] = ar[i+1]; ar[boundary] = pivot; for(i =0; i < number_of_ele;i++){ if(i < number_of_ele -1) cout<<ar[i]<<" "; else cout<<ar[i]<<endl; }
}
/* Tail starts here */
int main() {
vector
cin >> _ar_size;
for(int _ar_i=0; _ar_i<_ar_size; _ar_i++) {
int _ar_tmp; cin >> _ar_tmp; _ar.push_back(_ar_tmp);
}