1000012630.pdf
258 KB
#homework_2 #calculus #prep_midterm
You have 17 hours to solve it and then I will send the answers at the end of the day.⚠️ ⚠️ ⚠️
🔔 Stay be tuned 🔔
P.s don't forget sharing with your friends
@newuu_assignment
You have 17 hours to solve it and then I will send the answers at the end of the day.
@newuu_assignment
Please open Telegram to view this post
VIEW IN TELEGRAM
#physics_1 #personal_suggestion #prep_midterm
💻 Algorithms & Data structure
Click here: Link🔗
@newuu_assignment
It is highly recommended that this website might be useful for you to increase your knowledge in Algorithm and Data structure
Click here: Link
@newuu_assignment
Please open Telegram to view this post
VIEW IN TELEGRAM
#Tutorial 2.pdf
2.2 MB
#prep_midterm #answers #calculus
It is high time to check our work , hopefully you are able to solve all of them as much as possible.✔️
Tomorrow I will send you the second homework⚠️
P.s those answers were done by profs so you can make sure all of them are true 💯
🔔 Stay be tuned 🔔
@newuu_assignment
It is high time to check our work , hopefully you are able to solve all of them as much as possible.
Tomorrow I will send you the second homework
@newuu_assignment
Please open Telegram to view this post
VIEW IN TELEGRAM
🐳1
1711435588_Homework_3.pdf
170.1 KB
#homework_3 #calculus #prep_midterm
I will send the answers at the end of the day.⚠️ ⚠️ ⚠️
🔔 Stay be tuned 🔔
P.s don't forget sharing with your friends
@newuu_assignment
I will send the answers at the end of the day.
@newuu_assignment
Please open Telegram to view this post
VIEW IN TELEGRAM
🐳1
#date_struct #lab_6 #assignments
💻 Algorithms& Data structure
The answers of lab_6✅
Deadline | April 9 | 23:59🖥
There is a mistake in problem 4
@newuu_assignment
The answers of lab_6
Deadline | April 9 | 23:59
Sharing is caring
@newuu_assignment
Please open Telegram to view this post
VIEW IN TELEGRAM
problem 1
//by saidjonakr
#include<bits/stdc++.h>
using namespace std;
void heapify(int arr[], int n, int i){
int largest = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < n && arr[l] > arr[largest])
largest = l;
if (r < n && arr[r] > arr[largest])
largest = r;
if (largest != i) {
swap(arr[i], arr[largest]);
heapify(arr, n, largest);
}
}
void heapSort(int arr[], int n){
for (int i = n / 2 - 1; i >= 0; i--)
heapify(arr, n, i);
for (int i = n - 1; i >= 0; i--) {
swap(arr[0], arr[i]);
heapify(arr, i, 0);
}
}
int main(){
int n;
cin >> n;
int sz1 = (n+1)/2, sz = n/2;
int a[sz1], b[sz];
for(int i = 0; i < sz; i ++){
cin >> a[i] >> b[i];
}
if(sz1!=sz) cin >> a[sz];
for(int i = sz1/2-1; i >= 0; i--){
heapify(a, sz1, i);
}
heapSort(a, sz1);
for(int i = sz/2-1;i >= 0; i--){
heapify(b, sz, i);
}
heapSort(b, sz);
for(int i = 0; i < sz1/2; i++){
swap(a[i], a[sz1-1-i]);
}
for(int i = 0; i < sz; i++){
cout << a[i] << ' ' << b[i] << ' ';
}
if(sz1!=sz) cout << a[sz];
return 0;
}
problem 2
//by saidjonakr
#include<bits/stdc++.h>
using namespace std;
void heapify(long long arr[], int n, int i){
int largest = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < n && arr[l] > arr[largest])
largest = l;
if (r < n && arr[r] > arr[largest])
largest = r;
if (largest != i) {
swap(arr[i], arr[largest]);
heapify(arr, n, largest);
}
}
void heapSort(long long arr[], int n){
for (int i = n / 2 - 1; i >= 0; i--)
heapify(arr, n, i);
for (int i = n - 1; i >= 0; i--) {
swap(arr[0], arr[i]);
heapify(arr, i, 0);
}
}
int main(){
int n;
long long sum = 0;
cin >> n;
//n *= 2;
long long arr[n];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
for(int i = n/2-1; i >= 0; i--){
heapify(arr, n, i);
}
heapSort(arr, n);
for(int i = 0; i < n; i += 2){
sum += arr[i];
}
cout << sum;
return 0;
}
problem 3
//by saidjonakr
#include<bits/stdc++.h>
using namespace std;
void heapify(int arr[], int n, int i){
int largest = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < n && arr[l] > arr[largest])
largest = l;
if (r < n && arr[r] > arr[largest])
largest = r;
if (largest != i) {
swap(arr[i], arr[largest]);
heapify(arr, n, largest);
}
}
void heapSort(int arr[], int n){
for (int i = n / 2 - 1; i >= 0; i--)
heapify(arr, n, i);
for (int i = n - 1; i >= 0; i--) {
swap(arr[0], arr[i]);
heapify(arr, i, 0);
}
}
int main(){
int n;
cin >> n;
int arr[n];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
for(int i = n/2-1; i >= 0; i--){
heapify(arr, n, i);
}
heapSort(arr, n);
int temp = 1;
for(int i = 1; i < n; i ++){
if(arr[i-1] == arr[i]){
temp ++;
}else{
if(temp >= (n+1)/2){
cout << arr[i-1];
return 0;
}
temp = 1;
}
}
cout << arr[n-1];
return 0;
}
problem 4
//by saidjonakr
#include<bits/stdc++.h>
using namespace std;
void heapify(long long arr[], int n, int i){
int largest = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < n && arr[l] > arr[largest])
largest = l;
if (r < n && arr[r] > arr[largest])
largest = r;
if (largest != i) {
swap(arr[i], arr[largest]);
heapify(arr, n, largest);
}
}
void heapSort(long long arr[], int n){
for (int i = n / 2 - 1; i >= 0; i--)
heapify(arr, n, i);
for (int i = n - 1; i >= 0; i--) {
swap(arr[0], arr[i]);
heapify(arr, i, 0);
}
}
int main(){
int n;
cin >> n;
long long arr[n];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
for(int i = n/2-1; i >= 0; i--){
heapify(arr, n, i);
}
heapSort(arr, n);
long long mn = INT_MAX;
for(int i = 1; i < n; i++){
mn = min(mn, arr[i] - arr[i-1]);
}
for(int i = 1; i < n; i++){
if(arr[i] - arr[i-1] == mn){
cout << arr[i - 1] << " " << arr[i] << endl;
}
}
return 0;
}
🐳1 1