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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:46:30+00:00 2026-05-28T07:46:30+00:00

I was reading notes on Dynamic programming , and I encountered the following comment.

  • 0

I was reading notes on Dynamic programming, and I encountered the following comment.

If the subproblems are not independent, i.e.
subproblems share subsubproblems, then a divideand-conquer algorithm repeatedly solves the common
subsubproblems.
Thus, it does more work than necessary

What does this mean ? Can you give me examples to make the above point clear ?

  • 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-28T07:46:31+00:00Added an answer on May 28, 2026 at 7:46 am

    The author refers to the fact that many divide-and-conquer algorithms have subproblems that overlap with one another. Consider, for example, this very simple Fibonacci implementation:

    int Fibonacci(int n) {
        if (n <= 1) return n;
    
        return Fibonacci(n - 1) + Fibonacci(n - 2);
    }
    

    If you trace out the calls done to compute Fibonacci(4), we get

    • Fibonacci(4) calls Fibonacci(3) and Fibonacci(2)
    • Fibonacci(3) calls Fibonacci(2) and Fibonacci(1)
    • Fibonacci(2) calls Fibonacci(1) and Fibonacci(0)
    • Fibonacci(2) (the other one) calls Fibonacci(1) and Fibonacci(0)
    • Fibonacci(1) terminates.
    • Fibonacci(1) terminates.
    • Fibonacci(1) terminates.
    • Fibonacci(0) terminates.
    • Fibonacci(0) terminates.

    In other words, 9 total function calls are made, but there’s only five unique calls here (Fibonacci of 0 to 4, inclusive). This algorithm could be made much more efficient if the recursive calls were shared across the subproblems rather than recomputed from scratch each time. This is one of the key ideas behind dynamic programming.

    To compute Fn (the nth Fibonacci number), the above code will make a total of 2Fn+1 – 1 recursive calls. Since the Fibonacci numbers grow exponentially quickly, this requires exponentially much work. However, it’s possible to use the fact that many recursive calls are identical to simplify this dramatically. Rather than starting at Fibonacci(4) and working down, let’s start at Fibonacci(0) and work up. Specifically, we’ll build a table (let’s call it FTable) of length 5 and will fill it in as follows:

    • FTable[0] = 0
    • FTable[1] = 1

    Now, suppose we want to compute FTable[2]. This requires us to know FTable[0] and FTable[1], but we already do know that because they’re in the table. We thus can set

    • FTable[2] = 1

    Using similar logic, we can compute FTable[3] from FTable[2] and FTable[1]:

    • FTable[3] = 2

    And FTable[4] from FTable[2] and FTable[3]:

    • FTable[4] = 3

    Notice how we avoided making lots of overlapping recursive calls by just building them up in the reverse order! This now computes Fibonacci numbers in time O(n), which is exponentially faster than before. Using some more advanced math we can do even better than this, but this does illustrate why dynamic programming can take infeasible problems and make them suddenly feasible.

    Hope this helps!

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

Sidebar

Related Questions

I was reading this website for notes on closure: blog.morrisjohns.com/javascript_closures_for_dummies.html It had the following
I am making one application where i am reading mails from Lotus Notes. I
We have been reading and writing Sticky Notes/Annotations/Comments to pdfs via an activex control
I'm reading some notes about shared pointers. They say the first attempt by STL
After reading this article net.tutsplus.com/tutorials/javascript-ajax/14-helpful-jquery-tricks-notes-and-best-practices/ I came to conclusion that using this.href is more
I am reading about DFS in Introduction to Algorithms by Cormen. Following is text
I have a WPF Path object which is created by reading nodes from a
Reading this question I found this as (note the quotation marks) code to solve
Reading an article called Increase LINQ Query Performance in July's MSDN magazine, the author
Reading over the responses to this question Disadvantages of Test Driven Development? I got

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.