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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:56:02+00:00 2026-05-25T09:56:02+00:00

I was solving practice questions from a book when I stumbled upon this one

  • 0

I was solving practice questions from a book when I stumbled upon this one :

*Describe a recursive algorithm that will check if an array A of
integers contains an integer A[i] that is the sum of two integers
that appear earlier in A, that is, such that

 A[i] = A[j] +A[k] for j,k < i.

*

I have been thinking about this for a few hours but haven’t been able to come up with a good recursive algorithm.

  • 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-25T09:56:03+00:00Added an answer on May 25, 2026 at 9:56 am

    A recursive solution without any loops (pseudocode):

    bool check (A, i, j, k)
        if (A[j] + A[k] == A[i])
            return true
        else
            if      (k + 1 < j)      return check (A, i, j, k + 1)
            else if (j + 1 < i)      return check (A, i, j + 1, 0)
            else if (i + 1 < A.size) return check (A, i + 1, 1, 0)
            else                     return false
    

    The recursive function is called with check(A, 2, 1, 0). To highlight the main part of the algorithm it does not check if the array initially has more than two elements.

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

Sidebar

Related Questions

I'm solving some problem that involves Rabin–Karp string search algorithm. This algorithm requires rolling
I encountered this problem while solving a practice test Consider the following code written
I encountered this problem while solving a practice test Consider this C code to
Just curious what is the best practice for solving the following issue. I have
I need some help in solving this problem. We have a large amount of
This is my first effort on solving the exercise. I gotta say, I'm kind
UPDATE: Perhaps this wasn't clear from my original post, but I'm mainly interested in
I'm looking for a point in the right direction to solving this problem. I
While solving a geometry problem, I came across an approach called Sliding Window Algorithm.
I am solving my C assignment in Xcode and in that program i have

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.