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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:20:20+00:00 2026-06-13T13:20:20+00:00

Does implementing a procedure in a single pass mean non-recursive? Or does it mean

  • 0

Does implementing a procedure in a single pass mean non-recursive? Or does it mean that the procedure should never recur on the same information twice?

I ask this because I was under the impression that it was the first definition, but now I have stumbled across a homework problem that I can’t figure out without using recursion but says “complete in a single pass”.

  • 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-13T13:20:20+00:00Added an answer on June 13, 2026 at 1:20 pm

    A “single pass” means that each element in a collection of elements (be it: a list, an array, a set, a vector, a map, a tree, a graph, a string, etc.) is visited (“iterated over”) once and only once – it doesn’t matter if the procedure is recursive or iterative. For example, the following recursive procedure in Scheme adds all the elements in a list in a single pass:

    (define (sum lst)
      (if (null? lst)
          0
          (+ (car lst)
             (sum (cdr lst)))))
    

    The same procedure can be written in a tail recursive fashion – meaning: when the recursive call happens inside another procedure, is its final action; it may produce a return value which is then immediately returned by the calling procedure. Anyway, only a single pass is executed over the elements in the list:

    (define (sum lst)
      (let loop ((lst lst)
                 (acc   0))
        (if (null? lst)
            acc
            (loop (cdr lst) (+ (car lst) acc)))))
    

    Compare the above two examples with this code in Java: it’s an iterative method, but once again a single pass is performed over the array:

    int sum(int[] array) {
        int acc = 0;
        for (int x : array)
            acc += x;
        return acc;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm enamoured with the idea of implementing my own single-entry-point gateway that does two
Does anyone know of an ASP.NET guide to implementing OpenID and what information can
When implementing the Strategy Pattern, where does one put the code that determines which
I'm implementing a method that does something like: ... try { myPojo.setProperty(foo); myService.execute(myPojo); }
Implementing/handling idempotency in c# with Jolivers EventStore. Does this mean just taking care of
I'm implementing an application that does REST calls to a server to get a
I'm implementing a C++/CLI class library that does some low-level device-related stuff and exposes
From Wikipedia : Single responsibility principle states that every class should have a single
When implementing the using keyword to instantiate an IO.StreamWriter object does that imply that
I'm currently implementing an algorithm that does allot of linear algebra on small matrices

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.