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 627495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:32:06+00:00 2026-05-13T19:32:06+00:00

I was wondering if anyone could suggest to me how to implement this loop

  • 0

I was wondering if anyone could suggest to me how to implement this loop in the following pseudocode:

8: loop
9: while f[0] = 0 do
10: for i = 1 to N do
11: f[i ¡ 1] = f[i]
12: c[N + 1 – i] = c[N – i]
13: end for
14: f[N] = 0
15: c[0] = 0
16: k = k + 1
17: end while
18: if deg(f) = 0 then
19: goto Step 32
20: end if
……… …… ….
31: end loop

My question is how I should implement the loop that starts on line 8 and ends on 31; I am comfortable with the statements between lines 8 to 31, but what kind of loop do I use on line 8, and what conditions do I give for the loop?

Thanks in advance.

  • 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-13T19:32:07+00:00Added an answer on May 13, 2026 at 7:32 pm

    That’s an infinite loop. No conditions, just loop forever. The only way out is to get to step 19. In C-like languages you can write that as while (true) or for (;;):

    for (;;) {
        // ...
    
        if (deg(f) == 0) {
            goto afterLoop;
        }
    
        // ...
    }
    
    afterLoop:
    // ...
    

    goto is frowned upon, though. It’d be better to replace goto Step 32 with a break statement, which exits a loop immediately:

    for (;;) {
        // ...
    
        if (deg(f) == 0) {
            break;
        }
    
        // ...
    }
    

    For what it’s worth, if you didn’t have steps 21-30 you could use a do/while loop, where the loop condition goes at the bottom of the loop instead of the top:

    do {
        // ...
    }
    while (deg(f) != 0);
    

    That would work if lines 18-20 were the final lines in the loop. Since they’re not, it looks like option #2 is the one to go with.

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

Sidebar

Related Questions

just wondering if anyone could suggest why I might be getting an error? I'm
I was wondering if anyone could suggest to me potential libraries in ruby for
I was wondering if anyone could take a look at this code and help
I was wondering if anyone could point to an Open Source date utility class
I'm relatively new to ASP.NET and was wondering if anyone could shed some light
Wondering if anyone can help me with this annoying but trivial (in terms of
Im wondering if anyone has any input on this subject? Im building a flash
I'm wondering if anyone could help me out here. Is it possible when deleting
I was wondering if anyone could recommend a good LOC counter for .NET projects
Okay, I'm new to blackberry development and I was wondering if anyone could give

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.