Designing Regular Expressions

  Рет қаралды 711,738

Neso Academy

Neso Academy

Күн бұрын

TOC: Designing Regular Expressions
This lecture shows how design Regular Expressions for the following Languages:
1) Language accepting strings of length exactly 2
2) Language accepting strings of length at least 2
3) Language accepting strings of length atmost 2
Contribute: www.nesoacademy...
Website ► www.nesoacademy...
Facebook ► goo.gl/Nt0PmB
Twitter ► / nesoacademy
Pinterest ► / nesoacademy
Music:
Axol x Alex Skrindo - You [NCS Release]
• Axol x Alex Skrindo - ...

Пікірлер: 98
@haythama8563
@haythama8563 5 жыл бұрын
+ means OR, * means ZERO OR MORE, so if we translate the second expression it would be : (a OR b) (a OR b) [ ZERO OR MORE OF(a OR b) ], so the smallest possible string would be if * is Zero we would have only (a OR b)^2, therefore that RE represent any string of length at least 2. Same idea applies to 1 and 3.
@EarFarce4
@EarFarce4 5 жыл бұрын
THANKS!
@mnaresh3382
@mnaresh3382 6 ай бұрын
Refer this if Q2 seems difficult to understand In my perspective think of (a+b)* as the set containing all possible combinations from {episilon, a, b, aa, bb, ab, ba, aaa.....} So when we multiply say "aa" to this set do you there is any possibility of having an element "a" in our closure set, No we can't find one because we originally had one "a" in our set now after multiplication it was converted to "aaa" and possibly the other choice would be seeing epsilon, after multiplication it was changed to "aa" and we don't really care about all other terms since we can say for sure our set starts with element "aa" there is no way of finding an element of length one. Now just replace instead of multiplying "aa" we are multiplying what we need as a starting element which is (a+b) (a+b), and we got the answer
@AnkitVerma-ch5oi
@AnkitVerma-ch5oi 6 жыл бұрын
you are doing awesome work!
@apporvaarya
@apporvaarya 4 жыл бұрын
absolutely awesome this tutorial is
@ProfessionalTycoons
@ProfessionalTycoons 6 жыл бұрын
We can write the second answer as (a+b)(a+b)^+ - Cross sign
@rishubhbijlani2815
@rishubhbijlani2815 6 жыл бұрын
yeah thats what i thought, are you sure about this tho?
@CriticRoshun
@CriticRoshun 3 жыл бұрын
I agree
@diodesu
@diodesu 2 жыл бұрын
yeah, we should use the cross sign imo
@arnabghanty8448
@arnabghanty8448 4 жыл бұрын
GOD BLESS YOU.....❤️❤️
@riyapal8877
@riyapal8877 6 жыл бұрын
sir u are the bestest teacher ever!!!!!!
@Vardan019
@Vardan019 4 жыл бұрын
Hi riya can you give me your phone number
@alirizvi3506
@alirizvi3506 3 жыл бұрын
There is an error at 06:15, Correction: f we want single a so we should conconate with ebslon, same goes with b.
@jonaskoelker
@jonaskoelker 2 жыл бұрын
Just like a list of T can be defined as either nothing, or a pair of a T and a list of T, we can do strings of length at most k in this way: e + (a+b)(e + (a+b)(e + (a+b)(e + ...))). That is, each string of length at most k is either epsilon, or it's any symbol followed by the regular expression for strings of length at most k-1. This has the property that for any given string, for every '+' there is only one choice compatible with the given string.
@Shiva_polishetty
@Shiva_polishetty 6 жыл бұрын
If we give star for second sum it means.... String starts for empty but.. But there is no null(why we can't use cross symbol)
@ChristianBurnsShafer
@ChristianBurnsShafer 6 жыл бұрын
If you're talking about why there is a Kleene Star in the second example it is because he cannot exclude Epsilon from closure. That would make it so only strings greater than or equal to three would be accepted. There is a way to write this expression using the cross symbol, but that would be less simplified.
@dimplejain7226
@dimplejain7226 6 жыл бұрын
awesome videos!!!!helping me a lot
@gunjanshinde396
@gunjanshinde396 2 жыл бұрын
In example 3, How did we get (E +a +b) (E +a +b) ? I tried to get this from above equation. And farthest I reach is E + (a+b)(E+a+b). Can anyone tell the way ahead ?
@gunjanshinde396
@gunjanshinde396 2 жыл бұрын
​@Abbxs Okay, means as we are having a + b equation, we can 'or' it with itself which makes no difference to the equation and hence it is valid ? Something sound, thank you👍🏻👍🏻
@degoaty
@degoaty 2 жыл бұрын
What if 3 is (€ + a) (€ + b) (a+b) (a+b)?
@gunjanshinde396
@gunjanshinde396 Жыл бұрын
Hello @Abdullah kamal , the comment was done far before. Later I ask my few friends and I learnt that here we are taking few (but important) fundamental different then our basic, well know algebra. So one need to accept that to proceed. Hope you will find that in the above playlist. Good Luck ahead !
@null--404
@null--404 Жыл бұрын
We can just take (a+b)* which satisfies all conditions
@arnabdaw2587
@arnabdaw2587 6 ай бұрын
At 6:25, (R+R=R) is used So , one extra (a+b) is added to the expression, then u will get the above answer
@nehakumari1251
@nehakumari1251 3 ай бұрын
Plz explain it
@yashpaliwal2219
@yashpaliwal2219 6 жыл бұрын
in the condition... string of length atmost 2.. What is the approach to convert that exp €+a+b+aa+ab+ba+bb into (€+a+b)(€+a+b) ????
@ChristianBurnsShafer
@ChristianBurnsShafer 6 жыл бұрын
Understand that '€a' is a concatenation of 'a' with the empty string, returning 'a'. Interpret '+' as 'or'. E.g. € + a + aa + ab + b + ba + bb = (problem statement neatly arranged) € + €a + €b + a€ + aa + ab + b€ +ba +bb = (redundant terms added to simplify explanation) €(€ + a + b) + a(€ + a + b) + b(€ + a + b) = (factoring by identity (12)) (€ + a + b)(€ + a + b). (again, factoring by identity (12), and the desired answer) Good luck!
@sweetykarmakar4974
@sweetykarmakar4974 5 жыл бұрын
@@ChristianBurnsShafer I've seen all your Comments in this series, you're so intelligent!!! 😁😁😁😁
@sulavthapa2042
@sulavthapa2042 4 жыл бұрын
@@ChristianBurnsShafer Thanks bro
@anusuabiswas953
@anusuabiswas953 4 жыл бұрын
@@ChristianBurnsShafer can u plz xplain the 2nd one : at least 2
@shashikalaraju5769
@shashikalaraju5769 4 жыл бұрын
@@ChristianBurnsShafer Thank you .. that's actually inspiring.
@zackcarl7861
@zackcarl7861 2 жыл бұрын
I don't get it why (a+b)* when it says on language :must have atleast 2 elements ,but in (a+b)* there can be a, b ,or empty
@Omar-ic3wc
@Omar-ic3wc 2 жыл бұрын
(a+b)* means all the possible strings that you can create from the elements a and b
@NaveenShukla-nq6oe
@NaveenShukla-nq6oe 4 ай бұрын
(a+b)*(a+b)(a+b)(a+b)* will answer
@tayyab.sheikh
@tayyab.sheikh Ай бұрын
If you put (a+b)⁰ then it would be 1, and 1 multiplied by (a+b)(a+b) will give you the answer of the first question, similarly you can put (a+b)² and any number in the exponent, it will give you strings of at least length 2!
@dhanushsivajaya1356
@dhanushsivajaya1356 3 жыл бұрын
Thankyou sir
@hellb0y522
@hellb0y522 2 жыл бұрын
wayy better than my professor
@Argdut1106
@Argdut1106 7 жыл бұрын
Nice video. But where is Part 2 sir? Guess this is supposed to be Part 1?
@mihaichirculete7623
@mihaichirculete7623 4 жыл бұрын
kzbin.info/www/bejne/hXypo52rZa11bc0
@sam19r
@sam19r 6 жыл бұрын
(a+b)(a+b)+ for Q3?
@harsh_t
@harsh_t Жыл бұрын
Wrong. It doesn't produce Epsilon which is a valid output
@degoaty
@degoaty 2 жыл бұрын
In 6:35 What if 3 is (€ + a) (€ + b) (a+b) (a+b)?
@AhamedKabeer-wn1jb
@AhamedKabeer-wn1jb 4 жыл бұрын
THank you..
@soumisarkar4315
@soumisarkar4315 7 жыл бұрын
Sir please help me to solve this question The string 1101 does not belong the set represented by (a) 110*(0+1) (b) 1(0+1)*101 (c) (10)*(01)*(00+11)* (d) (00+(11)*0)*
@maheshjamdade1
@maheshjamdade1 6 жыл бұрын
1101 does not belong to c and d
@ChristianBurnsShafer
@ChristianBurnsShafer 6 жыл бұрын
(a) First one given, second one given, choose one zero, choose 1. 1101 belongs to this set. (b) First one given, choose €, second 1 given, 0 given, third 1 given. 1101 belongs to this set. (c) First one given, unwanted 0 given. 1101 does not belong to this set. (d) This set does not contain strings longer than 3. 1101 does not belong to this set.
@sulavthapa2042
@sulavthapa2042 4 жыл бұрын
@@ChristianBurnsShafer Can you elaborate please?
@umairsaeed2848
@umairsaeed2848 5 жыл бұрын
Can any one answer this please...? Construct a regular expression defining each of the following languages over the alphabet sigma={a,b}: 1). all words ends in 3 consecutive b. 2). all words heaving atleast 1 a. Thanks...
@Amit-cg9le
@Amit-cg9le 5 жыл бұрын
I think the ans. of your q. are 1) (a+b)* bbb 2) (a+b)* a (a+b)* But I am not sure about my answer ok.
@kaidokun2742
@kaidokun2742 6 жыл бұрын
I'm not sure what restrictions are on the language definition used here... but I based off basic regular expressions and I think my answers are simpler? L1: (a | b) (a | b) L2: (a | b) (a | b)+ L3: (a | b)* (a | b)* Does anyone else agree?
@ShivamGupta-nz7dy
@ShivamGupta-nz7dy 5 жыл бұрын
L3 is not correct, I think
@prabhakarshukla6430
@prabhakarshukla6430 5 жыл бұрын
L3 Incorrect
@ritabrotoganguly5729
@ritabrotoganguly5729 2 жыл бұрын
@@prabhakarshukla6430 why?
@yashshah7546
@yashshah7546 2 жыл бұрын
for length atleast 2 a+b* should come before a+b^2 also na?
@Games-ht8yz
@Games-ht8yz Жыл бұрын
Yes
@curias7
@curias7 6 жыл бұрын
for problem number 2 the answer could be just (a+b)*
@anshjain257
@anshjain257 5 жыл бұрын
This would contain strings of length less than 2
@anirudhyasarkhel8247
@anirudhyasarkhel8247 6 жыл бұрын
Sir please provide proof for those 2 theorems of Regular languages, imp for exam
@tiyashadas5247
@tiyashadas5247 4 жыл бұрын
Can the regular expression for atmost 2 be (a+b)* ?
@pratyushkumar3829
@pratyushkumar3829 4 жыл бұрын
No, because that would include all the strings over the language {a,b}. Meaning (a+b)* would also contain strings of length 3,4,5 and so on
@fritz6600
@fritz6600 2 жыл бұрын
Well, I was wondering it to be (a+b)(a+b)R*
@quantodedreamer9371
@quantodedreamer9371 2 жыл бұрын
@@pratyushkumar3829 no it doesnt affect because it is atleast 2.. the problem is (a+b)* also contains null value
@barnabassolomon1629
@barnabassolomon1629 6 ай бұрын
on question 2 why '*' instead of '+' symbol. its not supposed to include epsilon right?
@dh.418
@dh.418 6 ай бұрын
Yeah, I had the same doubt, but then I taught myself saying, even if ( a+b) * gives out a E, then end string would be (a+b) (a+b) E ...i.e simply (a+b) (a+b) , so this does not effect the outcome
@huh_wtf
@huh_wtf 5 жыл бұрын
At 3:50 (a+b) (a+b)^+ would work right?
@arisvrazitoulis5274
@arisvrazitoulis5274 4 жыл бұрын
No, star could represent e , so in your expression an example could be (a)(e) = a is formed but not accepted because we want at least 2
@sent4444
@sent4444 4 жыл бұрын
Yes, plus could not represent e
@MrRaman900
@MrRaman900 6 жыл бұрын
Sir can you please clarify that why we are doing union in first question(string of length exactly 2).
@arsha1625
@arsha1625 4 жыл бұрын
It's already taught in lecture 46. He taught ,when there are more than one element in the set without an epsilon .do OR operation ,ie; use + sign..that is union 👍
@prithhviraajchattopadhyay7698
@prithhviraajchattopadhyay7698 7 жыл бұрын
Can we write (a+b)*2......for Q1?
@owlietheowl8776
@owlietheowl8776 7 жыл бұрын
no we cannot as it is not a valid regular expression.
@shree2710
@shree2710 6 жыл бұрын
Saurav Kumar omg yws!! Thanks a lot
@venkateshprasadpatchava7733
@venkateshprasadpatchava7733 5 жыл бұрын
Can we take a out from L1 ...as you said that we can take a out from L3
@venkateshprasadpatchava7733
@venkateshprasadpatchava7733 5 жыл бұрын
I mean to ask u that u says we can take a from (e+a+b) if it is possible the we can take a out from (a+b) from L1 but the question is that we have to write the regular expressions only that takes exactly 2... That my doubt..
@ProfessionalTycoons
@ProfessionalTycoons 6 жыл бұрын
Also for the third answer can we write as (a+b)?(a+b)?
@perikilasujith7175
@perikilasujith7175 5 жыл бұрын
no coz u cant represent the null symbol
@neiljohn2637
@neiljohn2637 3 жыл бұрын
50
@deepakdeshmukh2013
@deepakdeshmukh2013 4 жыл бұрын
(a+ϵ).(b+ba)* : how to write this equation into simple English
@sinto4105
@sinto4105 4 жыл бұрын
(a+b)*
@prabhasreddymalla4615
@prabhasreddymalla4615 3 жыл бұрын
@@sinto4105 explain?
@degoaty
@degoaty 2 жыл бұрын
I think 3 is should be(€ + a) (€ + b) (a+b) (a+b) isn't it?
@gabrielpereiramendes3463
@gabrielpereiramendes3463 5 жыл бұрын
#Excelent!
@harshaahuja1926
@harshaahuja1926 4 жыл бұрын
2:50
@uselessvader
@uselessvader 4 жыл бұрын
Why is it not (a+b)(a+b)^+ for 2 at 3:52 ?
@HighbrowDirector
@HighbrowDirector 3 жыл бұрын
It says at least 2, (a+b)* can be null or more if it's null then we need at least two without * (a+b)(a+b)
@wel5457
@wel5457 6 жыл бұрын
Why cant we include € in 1 n 2 eg??
@BlizZarDaSh
@BlizZarDaSh 4 жыл бұрын
that's because in eg 3 the question was 'atmost 2' which means including no value that is defined as epsilion. 1 and 2 eg does not include no value so no epsilion.
@entertainclips6006
@entertainclips6006 6 жыл бұрын
For 3 Question could we write (a + b)* - (a +b)(a+b) ?
@sent4444
@sent4444 4 жыл бұрын
no minus defined
@asahoo550
@asahoo550 5 жыл бұрын
If language accepting at least 2 is an infinite set then how come it will be a regular expression.. It's can't be processed in FSA
@DnyaneshwarPanchaldsp
@DnyaneshwarPanchaldsp 4 жыл бұрын
💐💐💐💐👌
@PomegranateAmazing79
@PomegranateAmazing79 7 жыл бұрын
not very helpful
@ChristianBurnsShafer
@ChristianBurnsShafer 6 жыл бұрын
Either (1) you didn't understand the material, (2) you understand it and think it's useless, or (3) you already knew it and had no purpose watching the video in the first place. If it's the first case, try asking questions. If it's the second case then you're in the wrong field of expertise. If it's the third case then wth are you doing here. In any case you shouldn't just complain like a little fucking kid.
@S-S445
@S-S445 5 жыл бұрын
Tqsm sir
@MohamedMahmoud-ul4ip
@MohamedMahmoud-ul4ip 4 жыл бұрын
3:50
NFA to Regular Expression Conversion
13:37
Neso Academy
Рет қаралды 917 М.
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 87 МЛН
Пришёл к другу на ночёвку 😂
01:00
Cadrol&Fatich
Рет қаралды 10 МЛН
OYUNCAK MİKROFON İLE TRAFİK LAMBASINI DEĞİŞTİRDİ 😱
00:17
Melih Taşçı
Рет қаралды 5 МЛН
Pumping Lemma (For Regular Languages)
8:08
Neso Academy
Рет қаралды 1,3 МЛН
REGEX (REGULAR EXPRESSIONS) WITH EXAMPLES IN DETAIL | Regex Tutorial
10:43
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 854 М.
Learn Regular Expressions In 20 Minutes
20:52
Web Dev Simplified
Рет қаралды 1,3 МЛН
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 114 М.
Pumping Lemma (For Regular Languages) | Example 1
14:16
Neso Academy
Рет қаралды 1,2 МЛН
Theory of Computation: Construction of CFG - Examples
21:18
Anita R
Рет қаралды 289 М.
Regex to NFA Conversion Isn't Hard! (Sipser 1.28a)
9:15
Easy Theory
Рет қаралды 47 М.
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 87 МЛН