HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Examples of Context Free Languages

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
contextlanguagesexamplesfree

Problem

I'm having a hard time thinking of context free languages. The only example I've been able to think of is $0^n1^n$, but I'm having a hard time thinking of any others. Can I get some examples?

Solution

Here are some of the examples of context free languages

  • $\{ w \in \{0,1\}^*\mid \ w$ contains at least three ones }



  • $\{ w \in \{0,1\}^*\mid \ w = w^{R}$ and $\mid w \mid $ is even }



  • $\{ w \in \{0,1\}^*\mid \ $ the length of $w$ is odd and the middle symbol is $0$ }



  • $\{ a^{i} b^{j} c^{k} \mid \ i,j,k \ge 0 $ and $ i + j = k $ }



  • $\{ a^{i} b^{j} c^{k} \mid \ i,j,k \ge 0, $ and $ i = k $ or $i = k$ }



  • $\phi$



Reference : https://web.njit.edu/~marvin/cs341/hw/hwsoln05.pdf

Context

StackExchange Computer Science Q#71550, answer score: 4

Revisions (0)

No revisions yet.