Bubble Code
Tcs CodeVita
Share @coding_000❤️
#include <stdio.h>
int count_desc=0,count_asc=0;
void bubbleSort_descend(int array[], int size) {
for (int step = 0; step < size - 1; ++step) {
for (int i = 0; i < size - step - 1; ++i) {
if (array[i] < array[i + 1]) {
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
count_desc++;
}
}
}
}
void bubbleSort_ascend(int array[], int size) {
for (int step = 0; step < size - 1; ++step) {
for (int i = 0; i < size - step - 1; ++i) {
if (array[i] > array[i + 1]) {
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
count_asc++;
}
}
}
}
int main() {
int size;
scanf("%d",&size);
int data[size],data1[size];
for(int i=0;i<size;i++){
scanf("%d",&data[i]);
data1[i]=data[i];
}
bubbleSort_descend(data, size);
bubbleSort_ascend(data1, size);
if(count_desc>count_asc)
printf("%d",count_asc);
else
printf("%d",count_desc);
}
Tcs CodeVita
Share @coding_000❤️
#include <stdio.h>
int count_desc=0,count_asc=0;
void bubbleSort_descend(int array[], int size) {
for (int step = 0; step < size - 1; ++step) {
for (int i = 0; i < size - step - 1; ++i) {
if (array[i] < array[i + 1]) {
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
count_desc++;
}
}
}
}
void bubbleSort_ascend(int array[], int size) {
for (int step = 0; step < size - 1; ++step) {
for (int i = 0; i < size - step - 1; ++i) {
if (array[i] > array[i + 1]) {
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
count_asc++;
}
}
}
}
int main() {
int size;
scanf("%d",&size);
int data[size],data1[size];
for(int i=0;i<size;i++){
scanf("%d",&data[i]);
data1[i]=data[i];
}
bubbleSort_descend(data, size);
bubbleSort_ascend(data1, size);
if(count_desc>count_asc)
printf("%d",count_asc);
else
printf("%d",count_desc);
}
👍3🔥2🥰1
def calc_valency(element):
return sum(map(int, str(sum(map(int, map(str, map(ord, element))))))) % 9 or 9
def balance_compound(compound, eq_point):
elem1, elem2 = compound[0], compound[1]
val1, val2 = calc_valency(elem1), calc_valency(elem2)
results = []
for mult1 in range(1, eq_point // val1 + 1):
rem_point = eq_point - mult1 * val1
if rem_point % val2 == 0:
mult2 = rem_point // val2
results.append(f"{elem1}{mult1} {elem2}{mult2}")
for i in range(len(results) - 2, -1, -1):
print(results[i])
if not results:
print("Not Possible")
compound_input = input().strip()
equivalent_point_input = int(input().strip())
balance_compound(compound_input, equivalent_point_input)
Compound ✅
Codevita python3
Share @coding_000😊
return sum(map(int, str(sum(map(int, map(str, map(ord, element))))))) % 9 or 9
def balance_compound(compound, eq_point):
elem1, elem2 = compound[0], compound[1]
val1, val2 = calc_valency(elem1), calc_valency(elem2)
results = []
for mult1 in range(1, eq_point // val1 + 1):
rem_point = eq_point - mult1 * val1
if rem_point % val2 == 0:
mult2 = rem_point // val2
results.append(f"{elem1}{mult1} {elem2}{mult2}")
for i in range(len(results) - 2, -1, -1):
print(results[i])
if not results:
print("Not Possible")
compound_input = input().strip()
equivalent_point_input = int(input().strip())
balance_compound(compound_input, equivalent_point_input)
Compound ✅
Codevita python3
Share @coding_000😊
🔥2👍1👏1
Those who wants IBM
Help Free join and share my channel
✅ Share 😍😊✅
Don't pay to anyone 😊
we will post all solutions 😊
@Coding_000❤️ @Coding_000
share ✅ share ✅ share✅ our channel 😊
CONTACT- @ILOVEU_143 ❤️
Show some love and support guys😁
make 5k Our Channel 🎯
Help Free join and share my channel
✅ Share 😍😊✅
Don't pay to anyone 😊
we will post all solutions 😊
@Coding_000❤️ @Coding_000
share ✅ share ✅ share✅ our channel 😊
CONTACT- @ILOVEU_143 ❤️
Show some love and support guys😁
make 5k Our Channel 🎯
👍6🔥1🥰1
👍10🥰2🔥1
👍7🫡3
Get Ready...✅
Start at 11:07 👉 IBM
Give reactions...❤️
Start at 11:07 👉 IBM
Give reactions...❤️
❤26🔥2💘1
Guys plagiarism will be checked so please change method order and variable name
Share @Coding_000❤️
Everyone pls Follow this To qualify IBM 💯✅
Send your Coding Questions here 👇
https://t.me/exams_discussion
Share @Coding_000❤️
Everyone pls Follow this To qualify IBM 💯✅
Send your Coding Questions here 👇
https://t.me/exams_discussion
❤6
👍10🔥1
To remove Plagiarism 👇👇
1) Use your Own template✅
2) Change Variables ✅
3) Try to read input in unique style✅
4) Understand the code and write in your style ✅
5) Write whole code in main function / write in diffrent function✅
6) Change Function name solve()=> unique✅
7) If possible change flow of the problem (if it doesn't impact the logic of code)✅
there are so many other things to avoid Plagiarism🔥🔲
@Coding_000❤️
Everyone pls Follow this To qualify IBM 💯✅
1) Use your Own template✅
2) Change Variables ✅
3) Try to read input in unique style✅
4) Understand the code and write in your style ✅
5) Write whole code in main function / write in diffrent function✅
6) Change Function name solve()=> unique✅
7) If possible change flow of the problem (if it doesn't impact the logic of code)✅
there are so many other things to avoid Plagiarism🔥🔲
@Coding_000❤️
Everyone pls Follow this To qualify IBM 💯✅
👍15
👍11❤1
Coding | EXAMS | IBM ACCENTURE | VIRTUSA | IBM | AMAZON | TCS | EPAM | WILEY EDGE | TECH MAHINDRA | JPMORGAN | HCL | WIPRO
Photo
Euclidean distance code ✅ Python