Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

how to this yhat and that taht and that], Assignments of Machine Learning

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

2021/2022

Uploaded on 11/13/2022

himanshu-deo
himanshu-deo 🇮🇳

1 document

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROBLEM 1:
AIM:
Student Name: Aliasger Shabbirhusein Nazarali UID: 20BCS4880
Branch: CSE Section/Group: 601 A
Semester: 5 Subject Code: 20CSP-314
Subject Name: Competitive Coding-1
EXPERIMENT NUMBER 4
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download how to this yhat and that taht and that] and more Assignments Machine Learning in PDF only on Docsity!

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

EXPERIMENT NUMBER – 4

PROGRAM CODE:

#include #include #include #include #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 _a; int _a_item; for(int _a_i=0; _a_i<_a_size; _a_i++) { cin >> _a_item; _a.push_back(_a_item); }

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 best_values; while (abs(it->first) == best) { best_values.push_back(it->second); best_values.push_back(it->second - it->first); ++it; } sort(best_values.begin(), best_values.end()); for (auto it = best_values.begin(), end = best_values.end(); it != end; ++it) {

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 &arr, int i, int j){

if(i==j) return; int tmp = arr[i]; arr[i] = arr[j];

arr[j] = tmp;

}

/* Head ends here */

void partition(vector ar) {

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 _ar; int _ar_size;

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);

}