Koi ni harry bhai aap bhi insaan hi to ho baaki maine aapka pura python course follow kara hai aur a ye bahut maze aate hai aap free me hamara itna bhala katre ho god bless you and your family🙏🙏🙏🙏❤❤
aree bhaiya you are doing this much for us and telling like this.....you are god for us ....just keep on uploading Videos on Programming and Coding Till I Get Any Job ( CURRENTLY IN BTECH CSE 2ND YEAR) 😅😅
Kya Bat karte hain sir jaan de denge jaan😍😍😍 like to bahut dur ki bat hain(But majak se hatke really amazing sir u r great sir . sir kabhi kabhi mujhe lagta hai ki engineering student ke liye hire mathmetics ke liye Dr. Gajandra Prohit or programming ke liye Harry Boss ager na hote to hamara kya hota) aap dono ko egineering students ke traf se bahut der sare Thank you and love you both sir. jo engineering students sahmat hain like kare
To understand this problem : Just remember As we traverse the string ( expression ) from left to right for ( int i = 0; i < len; i++) { 1. if (we encounter a opening parentheses push it on to the stack) 2. Else if ( we encounter a closing parentheses ) if ( stack is empty || top element don't pair with closing parentheses ) return false; else{ pop() } } After the loop just check at last if ( stack is empty ) // means all opening parentheses found their closing counterparts return true; else // some opening parentheses not found their closing counterparts so they are not popped return false; For expression to be balanced every closure should be for the last unclosed [ ( ) ] ( -> last unclosed ) -> closure we encounter first // it will be for the last unclosed which is ) ( -> will be popped Updated list : [ ] [ -> last unclosed ] -> closure we encounter next Hope you understand !!
Bhai me apke video series dekh raha hu python vali bohot mza a raha h literally apne bohot mehnath se padhya i liked that. After i complete it i will definitely do the next programming language what you tough on the TH-cam.... Thank you very much Aman
We can use stacktop() If we check open and close parenthesis match befor poping element from stack. At that case, we need top element from stack which is need to be checked and then If matched, then pop and continue checking Else expression not balanced
exactly!! i was also thinking about the same logic. we do not need to pop directly, instead we check first , match it with stackTop, if it matches, then only we pop, else we return 0.
Someone....plz..Give a Noble Prize to Harry sir....Watching your C tutorial... And I am now at 9:09:35 ....Understood everything clearly...And love from Bangladesh...
He protecc.... He attacc..... But most importantly...... He the best coder who know the tec 🔥🔥🔥 Following your C 15 hour tutorial bro keep up the awesome work👍👍👍
If code is not running then allocate memory dynamically for the stack in the parenthesisMatch function i.e struct stack*sp = (struct stack *)malloc(sizeof(struct stack));
0:41 Sir I suppose that in our previous code while traversing the list our condition should be if it is '(' , '[' '{' then push in the stack and if it is ')', ']' or '}' then pop from the stack Like if correct
Bhai JavaScript Framework ke upar Ek combine video bnao jismein aap angular, react aur vue ka tips and tricks do ki Ham kisko choose Kare or fir uske upar aap course banoo, Main aapka web development ka JavaScript tutorials in Hindi ka course complete kar liya hai aur Mujhe front end web developer banna hai to front end web developer ke liye JavaScript and CSS frameworks bhi Aane chahie aur mujhe bahut jyada confusion ho rahi hai ki main JavaScript Framework kaunsa Sikho to please bhai kam karo.AUR EK VIDEO BANAO. My humble request to you. You are such a good teacher to teach programming languages that's why i am asking to you.
sir ek doubt hai , apne kahi pr stack ko heap me memory k liye request nhi kiya .....struct stack *sp=(struct stact*)malloc(sizeof(struct stack)) ....?
First of all, the popped character will always be one of these three ' ( ' or ' { ' or ' [ ' , now according to you, popped_char == exp[i] will be ' ( ' == ' ) ' which is false. ' ( ' is a different character than ' ) '. Matching the popped character and exp[i] will be matching ' ( ' with ' ) ' or ' ( ' with ' ] ' both of these are always false. suppose you've this expression " [ ( a + b ] ) " then first we'll push the character '[', then '(' will be pushed, when ']' is encountered, the top element in the stack is popped, that is '(' is popped, now we use the match function to match the following set '(' with ' ) ' and ' [ ' with ']'. here above, the popped element is ' ( ', but the current character is ' ] ', hence the match function will return false, since the following pair - ' ( ' , ' ] ' didn't match.
Sir Your Python For Absolute Beginners's Source code is not coming when i am clicking on the link ....sir please sort it out ...do not forget to reply me as well as correct me if i am wrong ...please do reply sir....Myself Arya
Brother, me JavaScript shikhna chahta hu. Lekin aapki channel pe do playlist hai JavaScript ki. Ek web development me or dusri JavaScript tutorial me. To me kon si playlist choose karu. Help me brother. Ho sake to link bhi de dena.
Bhaiya aapne parenthesis wale function me stack ki memory create hi nhi ki dynamicallly. struct stack* sp= (struct stack*)malloc(sizeof(struct stack));
bhai why don't we just increase value of top when we find opening parentheses and decrease it when we find closing one.....and using if else we can solve this.... we don't need to make an array....or stack for this
sir ne stack ka instance nai banaya hai,hame banana padega,sir yehh galti kiye hai, per sir yehh cheez pahle bataii huii thi isiliye 90% logo ko pata hai,per koi na ,u got it bro?? hame banana padega like this, struct stack *s=(struct stack*)mallock(sizeof(struct stack());
when i am trying to run this code in my vs code it doesn't show me any output and in online c compiler it shows me Segmentation fault what should i do ?
Ek galti ho gai choti si code me jo ki baad me theek bhi kar di! Maaf kar dena🙏🙏🙏
Bhya ap free m pra rhe ho wahii bohot h tnks bhai 🙏 🙏
Please flutter ka tutorial leao bhai plz
🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Koi ni harry bhai aap bhi insaan hi to ho baaki maine aapka pura python course follow kara hai aur a ye bahut maze aate hai aap free me hamara itna bhala katre ho god bless you and your family🙏🙏🙏🙏❤❤
Sir really you are making future of INDIA
aree bhaiya you are doing this much for us and telling like this.....you are god for us ....just keep on uploading Videos on Programming and Coding Till I Get Any Job ( CURRENTLY IN BTECH CSE 2ND YEAR) 😅😅
I have written code myself after understanding the logic but it took me 1 hr to write it
Kya Bat karte hain sir jaan de denge jaan😍😍😍 like to bahut dur ki bat hain(But majak se hatke really amazing sir u r great sir . sir kabhi kabhi mujhe lagta hai ki engineering student ke liye hire mathmetics ke liye Dr. Gajandra Prohit or programming ke liye Harry Boss ager na hote to hamara kya hota) aap dono ko egineering students ke traf se bahut der sare Thank you and love you both sir. jo engineering students sahmat hain like kare
To understand this problem :
Just remember
As we traverse the string ( expression ) from left to right
for ( int i = 0; i < len; i++) {
1. if (we encounter a opening parentheses push it on to the stack)
2. Else if ( we encounter a closing parentheses )
if ( stack is empty || top element don't pair with closing parentheses )
return false;
else{
pop()
}
}
After the loop just check at last
if ( stack is empty ) // means all opening parentheses found their closing counterparts
return true;
else
// some opening parentheses not found their closing counterparts so they are not popped
return false;
For expression to be balanced every closure should be for the last unclosed
[ ( ) ]
( -> last unclosed
) -> closure we encounter first // it will be for the last unclosed which is )
( -> will be popped
Updated list :
[ ]
[ -> last unclosed
] -> closure we encounter next
Hope you understand !!
harry bhai coding me gltiya n ho to programmer kaise banpayega koi..huge respect
Haary ❤️
Bhai me apke video series dekh raha hu python vali bohot mza a raha h literally apne bohot mehnath se padhya i liked that.
After i complete it i will definitely do the next programming language what you tough on the TH-cam....
Thank you very much
Aman
Thanks, Harry sir dil se......You create bright future for India.
You are a one in million...Thankyou for helping out in DSA
Bahit tagdi video hai bhai
Love you keep doing awesome work like this🖐👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍
You deserve millions subscribers. Excellent coder in you tube.
We can use stacktop()
If we check open and close parenthesis match befor poping element from stack.
At that case, we need top element from stack which is need to be checked and then
If matched, then pop and continue checking
Else expression not balanced
exactly!!
i was also thinking about the same logic.
we do not need to pop directly, instead we check first , match it with stackTop, if it matches, then only we pop, else we return 0.
int mulParenMatch(char* exp){
struct Stack*s;
s->top=-1;
s->size=50;
s->arr=(char*)malloc(s->size*sizeof(char));
for(int i=0;exp[i]!='\0';i++){
if(exp[i]=='(' || exp[i]=='{' || exp[i]=='['){
push(s,exp[i]);
}
else if(exp[i]==')' && s->arr[s->top]=='('){
if(isEmpty(s)){
return 0;
}
else{
pop(s);
}
}
else if(exp[i]=='}' && s->arr[s->top]=='{'){
if(isEmpty(s)){
return 0;
}
else{
pop(s);
}
}
else if(exp[i]==']' && s->arr[s->top]=='['){
if(isEmpty(s)){
return 0;
}
else{
pop(s);
}
}
}
return isEmpty(s);
}
then what's wrong in this code??
iss level kaa question solve ker kai maja aa gaya ❤👌💯💯💯
Yes I have done the programs in my code blocks already 😍😍
Someone....plz..Give a Noble Prize to Harry sir....Watching your C tutorial... And I am now at 9:09:35 ....Understood everything clearly...And love from Bangladesh...
তুই হিন্দি বুঝতে পারি
you are my inspiration to start my channel
sir ap ki c tutorial par video awesome ha .thanks alot❤❤
To great explanation
Love u bro
You are great
Nice Explanation Harry Bhai👍👍👍👍
Harry bhai aap pls competitive programming ke bhee questions karwa diya karo from Codechef
Excellent explanation 👌
Harry is God of Coding. 🙏
Badiya Harry bhai very helpful
Thank you Bhaiya such amazing videos ❤❤
Harry bhai app to ds ke sath advance c bhi sikha rhe ho 👍🏻
Sir, could you please make a video on character input and output, file copying , and character counting in c?
He protecc....
He attacc.....
But most importantly......
He the best coder who know the tec
🔥🔥🔥
Following your C 15 hour tutorial bro keep up the awesome work👍👍👍
you are best teacher
If code is not running then allocate memory dynamically for the stack in the parenthesisMatch function i.e
struct stack*sp = (struct stack *)malloc(sizeof(struct stack));
but it works on mine without allocating memory, how?
thanks..
thanks bro..but can you explain why was it was not working without dynamic memory allocation
Yes
Thank you Harry Bhai
Setup tour plzzz!!
👇
Excellent explanation ❤️
You are doing a great job 😘
Thanks for saving my life
0:41
Sir I suppose that in our previous code while traversing the list our condition should be if it is '(' , '[' '{' then push in the stack and if it is ')', ']' or '}' then pop from the stack
Like if correct
Bhai JavaScript Framework ke upar Ek combine video bnao jismein aap angular, react aur vue ka tips and tricks do ki Ham kisko choose Kare or fir uske upar aap course banoo, Main aapka web development ka JavaScript tutorials in Hindi ka course complete kar liya hai aur Mujhe front end web developer banna hai to front end web developer ke liye JavaScript and CSS frameworks bhi Aane chahie aur mujhe bahut jyada confusion ho rahi hai ki main JavaScript Framework kaunsa Sikho to please bhai kam karo.AUR EK VIDEO BANAO. My humble request to you. You are such a good teacher to teach programming languages that's why i am asking to you.
Very good video 👍😀😀 keep it up 👌
Goat=harry bhai❤❤
superb bro
Thanks a lot bhaiya, Enjoyed this video
Please flutter ka tutorial le ao bhai please
Btw love your video's 👍👍👍👍👍
Awesome video 👍👍👍👍
Harry bhai waise "I'll see you next time" ki jagah "U'll see me next time" hona chahiye na 😂😂
Funny!
Thank you sir🤩
Thank you harry bhai for such awesome course 🙏🙏🙏
We can check the match using ascii value diff
thanks a lot sir this playlist is very helpful
Thanks harry bhi
Thankyou 🙏
sir ek doubt hai , apne kahi pr stack ko heap me memory k liye request nhi kiya .....struct stack *sp=(struct stact*)malloc(sizeof(struct stack)) ....?
< ................Gjjb ka explanation !!!!!!!!!!!!! mast hai.........>
Excellent
Great 👍👍
Harry bahi issue hai (how to minimize main-thread work in blogger) please batiya Harry bhaiya
Nice sirr
Who's watching in December 2024 and will continue in 2025. 😆
thanks_Sir💜
Harry bhai👏👏
Best Bhai ❤️👌💯
Best as usual❤️❤️❤️❤️
Thanku Harry Bhai
Love you 😊😊❤ legend
Why do we need a different match function ? Can't we match the popped character and the exp[I] directly ? Will it give errors ?
First of all, the popped character will always be one of these three ' ( ' or ' { ' or ' [ ' , now according to you, popped_char == exp[i] will be ' ( ' == ' ) ' which is false. ' ( ' is a different character than ' ) '. Matching the popped character and exp[i] will be matching ' ( ' with ' ) ' or ' ( ' with ' ] ' both of these are always false. suppose you've this expression
" [ ( a + b ] ) " then first we'll push the character '[', then '(' will be pushed, when ']' is encountered, the top element in the stack is popped, that is '(' is popped, now we use the match function to match the following set '(' with ' ) ' and ' [ ' with ']'. here above, the popped element is ' ( ', but the current character is ' ] ', hence the match function will return false, since the following pair - ' ( ' , ' ] ' didn't match.
@@manjitsharma889 thank you so much for the explanation
same doubt
Sir Your Python For Absolute Beginners's Source code is not coming when i am clicking on the link ....sir please sort it out ...do not forget to reply me as well as correct me if i am wrong ...please do reply sir....Myself Arya
thankew
Harry bhai please reply fast ....
I am not able to use jupyter notebook
Appki puri video dekh rha hu
Sir I am using online compiler and your code was giving same error as in the previous video i.e. segmentation fault please reply my question 🥺🥺🥺🥺
run those code in code blocks!! bro!
i am also try to run those code in online compiler and it throws TLE error!
You've to use "struct Parenthesis * p= (struct Parenthesis *)malloc(sizeof(struct Parenthesis))" instead of "struct Parenthesis * p" only .
Sir no udemy...🖒🖒
Only Code with Harry...🖒🖒
sir ap ki typing speed kitni hai ? or kitni typing speed programing kar lae achi hai?
Please bahi apple kay lia appstore may app publish karnay kay liay video banaw or hum 1 app ko kitnay jaga publish karsaktay hai
Harry bhai aap online classes chalu kar do
Brother, me JavaScript shikhna chahta hu. Lekin aapki channel pe do playlist hai JavaScript ki. Ek web development me or dusri JavaScript tutorial me.
To me kon si playlist choose karu. Help me brother. Ho sake to link bhi de dena.
Javascript playlist. In that playlist some projects are also.
Harry sir did
it before 1:20
Please make data structures and algorithms using python with notes in 1 video
Bhaiya aapne parenthesis wale function me stack ki memory create hi nhi ki dynamicallly.
struct stack* sp= (struct stack*)malloc(sizeof(struct stack));
Bro, he has created it and one more thing it will be--> (struct stack*)malloc(sp->size*sizeof(struct stack));
Already accessed
Please upload vedios on Graph data structure harry bhai
Thank you sir.
Mere DS ke karta dharta aap hi ho🙏😁
bhai why don't we just increase value of top when we find opening parentheses and decrease it when we find closing one.....and using if else we can solve this....
we don't need to make an array....or stack for this
*sir aap Multiple Parenthesis Matching ko as an homework bhi de sakhte thay*
Harry sir, ye data structures ka course kitne moth ka h? Plz ek bar bta dijiye bdi kripa hogi....🙏
Bro isme stack *pointer banaya par usko initialise Kyun nahi karaya heap se stack type ki memory lekar calloc ya Mallock se
sir ne stack ka instance nai banaya hai,hame banana padega,sir yehh galti kiye hai, per sir yehh cheez pahle bataii huii thi isiliye 90% logo ko pata hai,per koi na ,u got it bro?? hame banana padega like this,
struct stack *s=(struct stack*)mallock(sizeof(struct stack());
Thanks bhai
Mast video
when i am trying to run this code in my vs code it doesn't show me any output
and in online c compiler it shows me Segmentation fault what should i do ?
Bhai stack *ptr ko heap se memory dedo
You've to use "struct Parenthesis * p= (struct Parenthesis *)malloc(sizeof(struct Parenthesis))" instead of "struct Parenthesis * p" only bro.
how to take input from the user in this code , can anybody can help
please fast
Sir ,multiple parenthesis ka aapka ye code codeblocks m run nhii ho para h
Done done
Why is this program not working? Please help.
#include
using namespace std;
struct array_Stack {
int size;
int top = -1;
char * arr;
};
bool is_Full(struct array_Stack * p) {
if (p->top == p->size - 1)
{
return true;
}
return false;
}
bool is_Empty(struct array_Stack * p) {
if (p->top = -1)
{
return true;
}
return false;
}
void push(struct array_Stack * p, char value) {
if (is_Full(p))
{
cout
bhai c# ka course kab laho ge
Sir, Whenever you add new part to program
Please tell b/w which to part you pasted it.
We can also this problem by creating three structure pointers for three different brackets as it is shown below
int parenthesis(char *equation)
{
struct stack *s;
s = (struct stack *)malloc(sizeof(struct stack));
s->size = strlen(equation);
s->arr = (char *)malloc(s->size * sizeof(char));
s->top = -1;
struct stack *t;
t = (struct stack *)malloc(sizeof(struct stack));
t->size = strlen(equation);
t->arr = (char *)malloc(s->size * sizeof(char));
t->top = -1;
struct stack *u;
u = (struct stack *)malloc(sizeof(struct stack));
u->size = strlen(equation);
u->arr = (char *)malloc(s->size * sizeof(char));
u->top = -1;
for (int i = 0; i < s->size; i++)
{
if (equation[i] == '(')
{
push(s, '(');
}
else if (equation[i] == ')')
{
if (isempty(s))
{
return 0;
break;
}
else
{
pop(s);
}
}
else if (equation[i] == '{')
{
push(t, '{');
}
else if (equation[i] == '}')
{
if (isempty(t))
{
return 0;
break;
}
else
{
pop(t);
}
}
else if (equation[i] == '[')
{
push(u, '[');
}
else if (equation[i] == ']')
{
if (isempty(u))
{
return 0;
break;
}
else
{
pop(u);
}
}
}
if (isempty(s)==isempty(t)==isempty(u)==1)
{
return 1;
}
else
{
return 0;
}
}
bro i dont think this will work for wrong brackets expression like -- [(34*21])
We want dsa videos fast!
notes wale link pe click krne pe, notes ke pdf download krne ke option nhi aa rhe ....plz someone help.
jitna b lamba expression hai aghr ik bhi unbalance ho gya to baaqi ignore krdain gy?
Sir big fan heart plz
cant we make just 3 stacks for different brackets
code that you have provided is showing segmentation error
Alternative code:
#include
#include
#include
#define max 100
char stack[max],expr[max];
int top =-1;
int match(char);
void check();
int isEmpty();
void push(char);
char pop();
void push(char x){
if(top == max-1){
printf("Stack_overflow
");
return;
}
else{
top = top + 1;
stack[top] = x;
}
}
char pop(){
if(top == -1){
printf("Stack_underflow
");
printf("
Unbalanced expression !!
");
exit(0);
}
else{
char c = stack[top];
top = top - 1;
return c;
}
}
int isEmpty(){
if(top == -1)
return 1;
else
return 0;
}
int match(char x){
switch(x){
case '(':
case ')':
return 3;
case '{':
case '}':
return 2;
case '[':
case ']':
return 1;
}
}
void check(){
int i = 0;
char element,x;
while(i
#include
using namespace std;
struct stack{
int size;
int top;
char* arr;
};
void push(struct stack* p, char element){
if(p->top == p->size-1){
coutarr = new char(p->size);
for(int i = 0; itop == -1){
return 0;
}
else{
if(p->arr[p->top] == '(' && s[i] == ')'){
pop(p);
}
else if(p->arr[p->top] == '[' && s[i] == ']'){
pop(p);
}
else if(p->arr[p->top] == '{' && s[i] == '}'){
pop(p);
}
else{
return 0;
}
}
}
}
if(p->top == -1){
return 1;
}
else{
return 0;
}
}
int main()
{
string s = "([7-9}-7)";
if(parathesischeck(s)){
cout