Prefix Expression Evaluation | C++ Placement Course | Lecture 23.5
HTML-код
- Опубликовано: 8 фев 2021
- Complete C++ Placement Course (Data Structures+Algorithm) : • C++ Full Course | C++...
Telegram: t.me/apnikakshaofficial
Instagram: / dhattarwalaman
Notes of this Lecture:
finaly i understand what is the use of stack a big thank you🙏
I love apna college.......tussi humesha best rahoge
Please make vedio on specialization Artificial intelligence and machine learning, this area is different portion of cse, Please make a vedio on it.
Thank you 🙏
It wont work on expressions which contain more than double digits.Please refer this too
shukriya
Very nice 👌👍👌👍
This will only work on one-digit operands
Pls upload web development remaining course!!
Hello aman bhaiya you are doing a great job, bhaiya stack ka notes ni hai course me , wo ni mile ga kya bhaiya.
Thoda sa kaam ham bhi kar h yr notes banana koi badi baat nahi h aur jab ham khud notes bana rahe hote h to hame hi benifit hota h concepts ko samajhane me🤞
Waiting to enter the CP part 🔥
What if the operand are 2 digit integer?
Please upload chemistry lectures
Mam, please add daily notes link in the description.
Also in postfix,
We do *op2 + op1* OR *op2 - op1* OR *op2 * op1* OR *op2 / op1*
Not -- *op1 + op2* OR *op1 - op2* OR *op1 * op2* OR *op1 / op2*
Op2/oP1
Thank you so much for this wonderful series....
I want to place in GOOGLE it's my dream
These vedios are help me from scratch and icing on cake is it's free which is most important 😅
Please upload such series for python and Java too
videos....not vedios
AYY!! lets go! my dream company is google as well. I hope u make it through :D
u guys giving kickstart??? or codejam
next one(kickstart) in august, goomd lumck comrades
i'll cme bk and respond how it went, u2do :D
@@ShubhivDogra congrats you got selected -- Google
@@harshavardhan8086 thanks buddy
i think it won't work on the no. if it is a 2digit no. as we are checking every character so it would be considering 25 which is a no. as 2 seprate no. 5 and 2 we have to optimize the code
Yes you are right
Yup bro u r correct
Use isadigit()
java code for it :
import java.util.Scanner;
import java.util.Stack;
public class Rough{
static Stack st = new Stack();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Expression");
String s = sc.next();
System.out.println(evaluation(s));
}
static int evaluation(String s) {
for(int i = s.length()-1 ; i>=0 ; i--) {
if(s.charAt(i) == '0' || s.charAt(i) == '1' ||s.charAt(i) == '2' ||s.charAt(i) == '3' ||
s.charAt(i) == '4' ||s.charAt(i) == '5' ||s.charAt(i) == '6' ||s.charAt(i) == '7' ||s.charAt(i) == '8' || s.charAt(i) == '9' ) {
st.push(s.charAt(i) - '0');
}
else {
int a = st.peek();
st.pop();
int b = st.peek();
st.pop();
switch(s.charAt(i)) {
case '+' :
st.push(a+b);
break;
case '-' :
st.push(a-b);
break;
case '*' :
st.push(a*b);
break;
case '/' :
st.push(a/b);
break;
case '^' :
st.push((int) Math.pow(a, b));
break;
}
}
}
return st.peek();
}
}
Can u pls give me c code for it or else tell me the changes 🙏pls
wht if prefix expression as a string consists of blank space ' ' ?
Very very good explanation dii❤️
Can anyone tell, what is the font that she is using?
Postfix expression mai pehla operand , operand 1 hota tha par prefix expression mai dusra operand , operand 1 q hai ?
Jaise last video mai 4 operand 1 tha par is video mai 0 operand 1 nahi hai balki 2 operand 1 hai
notes plz :)
🔥🔥🔥
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
4:31 what is logic behind we are using --'0'
string is basically a array of character and to covert character to int you have to subtract ASCII value of zero i.e 48
@@pranjalbajpai156 thanks... 🙏
@@pranjalbajpai156 Thanks
@Omkar Sase Bhai string ko integer stack mein nahi daal sakte. As we are traversing a string the ASCII code of the element will be of character.
Let's take an example
The ASCII of '9' is 57.
The ASCII of '0' is 48.
The ASCII of the integer 9 is 9 itself .
The ASCII of the integer 0 is 0 itself .
So when we do ('9' -'0') we get (57-48) which is 9.
Thats the logic.
@@sonit9707 thank you 👍
Didi division me op2/op1 hoga
Thankyou🙏
bhaiya notes upload karo pls !!
at first there's no element int the stack so how can we use else{ int op1= st.top(); st.pop()
@@divyansh2212 thank you. it was helpful.
It's very nice but I have generated error while define stack st;
Error 1) stack is ambiguous.
2)int type name not allowed.
3)and st is undefined.
So please help me
Add #include in header file
what if i have to use a number greater than 9, how will i do that?
switch use kiya ha tuo default nahi use karna padaga
Does it work for brackets???
Why you need brackets, there is no need of them once precedence is decided.
Okay i am too early!😅
Aman bhayya
I'm a current first year student
Lack of preparation knowledge getting fear of semester exams.
I'm feeling like why I took course where there is no book like ncert for engineering.
Yaar koi bta do line 13 mai - kyo Kiya hai plzzz
St.push(s[i]-'0');
In the if part if we have number gerater than 9 then it will also be the valid condition or not ?
compiler only read single number at a time and 9 is the greatest number.
I think you should read the code carefully and understand what is actually happening.
bhaiya jaldi videos upload kare
Bhai ab to ho great videos upload I think...haha
im getting the ans -25
why are we writing minus 1 while iterating in for loop...?? 😶😶😑
string contain NULL at the last .
We start iteration from last so for that we took Size-1 (length-1) it start with last element
Bhaiya aapka aim kya h life mein?
dont know why but with the same code my answer is coming -47 consistently
same
Here anyone who want to learn code with me together
Why you are uploading the videos too late?Please upload video everyday
This program cannot be used for no. Greater that 9
Any way to solve that
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Hii sir please Chemistry ke lecture upload kijiyee baki chapter ke please sir phir revise bhi karna hai please sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏