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

  • Home
  • SEARCH
  • 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 8796371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:36:25+00:00 2026-06-13T23:36:25+00:00

How do I convert the following pseudo code into an array instead of a

  • 0

How do I convert the following pseudo code into an array instead of a stack. The algorithm is intended to construct a digraph given a certain input:

  1. Scan the formula from right to left calling symbols on a stack until 2 consecutive node symbols appear on top.
  2. Pop off these 2 node symbols and the ‘*’ just below them on the stack. Draw an edge from the first symbol to the second.
  3. Push the first symbol on the stack.
  4. Continue steps 1-3 until the formula is processed.

Here is a sample input and output:

Input:

***ABCD

Output:

*AB, *AC, *AD

‘*’ represents an edge

All inputs will be done using a scanner.

  • 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-06-13T23:36:27+00:00Added an answer on June 13, 2026 at 11:36 pm

    You have basically to perform operations on the array using the FIFO propriety.

    public ArrayStack( )
    {
        theArray = new String[InitialSize];
        topOfStack = -1;
    }
    

    Every time you add an element to your array (push) you do topOfStack++; and insert the element on the "topOfStack" position of the array. By doing topOfStack++ you are keeping track of the array position that became the new top of the stack.

    When you do pop you must check if the array is not empty, return the element on array[topOfStack] and do topOfStack--;. Because the top is now the previous position on the array.

    If you need more space for your array because the stack is full (topOfStack == InitialSize) you have to create another array with more space, for example :

    private void doubleArray( )
    {
            String [] newArray = new String[ theArray.length * 2 ];
            for( int i = 0; i < theArray.length; i++ )
                newArray[ i ] = theArray[ i ];
            theArray = newArray;
     }
    

    For stating, this is roughly what you need to look for, naturally, there are many more details to look into. Nevertheless, try it out yourself, and when you have doubts look for resources such as this.

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

Sidebar

Related Questions

I am trying to convert following table data into nested array using PHP. I
I need to convert this following XAML into code-behind: <ComboBox SelectedItem={Binding Level} ItemsSource={Binding Levels}
I want to convert following html code into continuous string using jquery/javascript. <ul> <li>one</li>
Can anyone provide a working sample code to convert following Oracle DB table with
I am a java devloper and I wish to convert following code to java
How to correctly convert the following C++ into C#? //-------------------------------------------------------------------- // Calculate a 16-bit
How can I convert the following array: (Assume I don't know how many depth
I would like to convert following Query into HQL Query. How can i do?
How to convert following vb code in to c#? Dim request As HttpWebRequest =
How do I convert the following Android code to MonoAndroid code? //Open your local

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.