Explanation:
the perimeter of an aluminium sheet is 120 CM if its length is reduced by 10% and its breadth is increased by 20% the perimeter does not change find the measure of the length and the breadth of the sheet
Answer:
#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string str)
{
char a,b;
int length = str.length();
for (int i = 0; i < length / 2; i++)
{
a=tolower(str[i]);//Converting both first characters to lowercase..
b=tolower(str[length-1-i]);
if (b != a )
return false;
}
return true;
}
int main() {
string t1;
cin>>t1;
if(isPalindrome(t1))
cout<<"The string is Palindrome"<<endl;
else
cout<<"The string is not Palindrome"<<endl;
return 0;
}
Output:-
Enter the string
madam
The string is Palindrome
Enter the string
abba
The string is Palindrome
Enter the string
22
The string is Palindrome
Enter the string
67876
The string is Palindrome
Enter the string
444244
The string is not Palindrome
Explanation:
To ignore the cases of uppercase and lower case i have converted every character to lowercase then checking each character.You can convert to uppercase also that will also work.
1. The current is the same everywhere in the circuit. This means that wherever I try to measure
the current, I will obtain the same reading.
2. Each component has an individual Ohm's law Voltage Drop. This means that I can calculate
the voltage using Ohm's Law if I know the current through the component and the resistance.
3. Kirchoff's Voltage Law Applies. This means that the sum of all the voltage sources is equal to
the sum of all the voltage drops or
VS = V1 + V2 + V3 + . . . + VN
4. The total resistance in the circuit is equal to the sum of the individual resistances.
RT = R1 + R2 + R3 + . . . + RN
5. The sum of the power supplied by the source is equal to the sum of the power dissipated in
the components.
<span>PT = P1 + P2 + P3 + . . . + PN</span>
Answer:
PER= 0.824
Explanation:
Total bytes = 1024+6
=1030 bytes
=1030*8 bits
= 8240 bits
BER = 0.0001
Packet Level Error (PER) = 8240*0.0001
= 0.824
Big-O notation is a way to describe a function that represents the n amount of times a program/function needs to be executed.
(I'm assuming that := is a typo and you mean just =, by the way)
In your case, you have two loops, nested within each other, and both loop to n (inclusive, meaning, that you loop for when i or j is equal to n), and both loops iterate by 1 each loop.
This means that both loops will therefore execute an n amount of times. Now, if the loops were NOT nested, our big-O would be O(2n), because 2 loops would run an n amount of times.
HOWEVER, since the j-loop is nested within i-loop, the j-loop executes every time the i-loop <span>ITERATES.
</span>
As previously mentioned, for every i-loop, there would be an n amount of executions. So if the i-loop is called an n amount of times by the j loop (which executes n times), the big-O notation would be O(n*n), or O(n^2).
(tl;dr) In basic, it is O(n^2) because the loops are nested, meaning that the i-loop would be called n times, and for each iteration, it would call the j-loop n times, resulting in n*n runs.
A way to verify this is to write and test program the above. I sometimes find it easier to wrap my head around concepts after testing them myself.