Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 263569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:36:45+00:00 2026-05-11T22:36:45+00:00

I’m studying for a test on PDA, and I want to know how to

  • 0

I’m studying for a test on PDA, and I want to know how to design a pushdown automaton that recognizes the following language:

L = {a^max(0,n-m)b^n a^m| n,m >=0} 

How can I design a transition function to recognize if n-m is greater than 0?

And please, if you have some course materials with exercises of this level solved, put a link.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:36:46+00:00Added an answer on May 11, 2026 at 10:36 pm

    you can decide where to go from a current state based on the value on top of the stack, you use symbols on the stack to keep notes about the state of the parsing.

    here is how i think this would work:
    this are symbols read from the input, THIS are symbols on a stack.
    the symbol X on the botoom of the stack means that n <= m
    do not confuse X with Z, which is the initial symbol of the stack and helps determine when the stack is empty.

    there are probably some problems with this solution, but it the overall approach should be correct.

    … and good luck with your test 🙂


    first you read all the a symbols from the beginning of the string and add A to a stack for each of them, or push X if there was no a

    then you read all the b symbols:

    • if the stack is empty (Z is on top), B is on top or X is on top, then you push another B to the stack.
    • if stack has A on top, then you remove it.

    the last step is to read the final a symbols.

    • if there is B on the stack, remove it.
    • if there is X on the stack, then keep it there
    • if the stack is empty (Z on top), then this must be the end of the string

    another edit:

    sorry if the above isn’t clear … i’ll try to formalize it.

    accepting states are (4) and (5), starting state is (1). and it’s nondeterministic

    and the transition rules:

    state (1) : read the first batch of a symbols

    • (1) a; Z / AZ -> (1)
    • (1) a; A / AA -> (1)
    • (1) epsilon; A / A -> (2)
    • (1) epsilon; Z / Z -> (2)

    state (2) : read b symbols

    • (2) b; Z / BZ -> (2)
    • (2) b; X / BX -> (2)
    • (2) b; B / BB -> (2)
    • (2) b; A / epsilon -> (2)
    • (2) epsilon; B / B -> (3)
    • (2) epsilon; X / X -> (3)
    • (2) epsilon; Z / Z -> (3)

    state (3) : read the last as

    • (3) a; B / nothing -> (3)
    • (3) epsilon; X / X -> (4)
    • (3) epsilon; Z / Z -> (5)

    state (4) : the trailing as if m > n

    • (4) a; X / X -> (4)

    state (5) is for accepting the exact string when m < n

    (and just to be absolutely clear — when there is no way of a state and the reading cursor is not at the end of the word, then the word is not accepted)

    This could maybe be made a bit simpler by using adidional states instead of the stack symbol X, but i guess you can do it yourself 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.