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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:40:07+00:00 2026-05-26T19:40:07+00:00

I am reading about Dynamic programming in Cormen etc book on algorithms. following is

  • 0

I am reading about Dynamic programming in Cormen etc book on algorithms. following is text from book

Suppose we have motor car factory with two assesmly lines called as line 1 and line 2. We have to determine fastest time to get chassis all the way.

Ultimate goal is to determine the fastest time to get a chassis all the way through the factory, which we denote by Fn. The chasssis has to get all the way through station “n” on either line 1 or line 2 and then to factory exit. Since the faster of these ways is the fastest way through the entire factory, we have

Fn = min(f1[n] + x1, f2[n]+x2) ---------------- Eq1

Above x1 and x2 final additional time for comming out from line 1 and line 2

I have following recurrence equations. Consider following are Eq2.

f1[j]  = e1 + a1,1                                    if j = 1
             min(f1[j-1] + a1,j, f2[j-1] + t2,j-1 + a1,j  if j >= 2

f2[j]  = e2 + a2,1                                    if j = 1
             min(f2[j-1] + a2,j, f1[j-1] + t1,j-1 + a2,j  if j >= 2

Let Ri(j) be the number of references made to fi[j] in a recursive algorithm.

From equation R1(n) = R2(n) = 1

From equation 2 above we have

R1(j) = R2(j) = R1(j+1) + R2(j+1)  for j = 1, 2, ...n-1

My question is how author came with R(n) =1 because usally we have base case as 0 rather than n, here then how we will write recursive functions in code
for example C code?

Another question is how author came up with R1(j) and R2(j)?

Thanks for all the help.

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

    If you solve the problem in a recursive way, what would you do?
    You’d start calculating F(n). F(n) would recursively call f1(n-1) and f2(n-1) until getting to the leaves (f1(0), f2(0)), right?

    So, that’s the reason the number of references to F(n) in the recursive solution is 1, because you’d need to compute f1(n) and f2(n) only once. This is not true to f1(n-1), which is referenced when you compute f1(n) and when you compute f2(n).

    Now, how did he come up with R1(j) = R2(j) = R1(j+1) + R2(j+1)?
    well, computing it in a recursive way, every time you need f1(i), you have to compute f1(j), f2(j), for every j in the interval [0, i) — AKA for every j smaller than i.
    In other words, the value of f1,2(i) depends on the value of f1,2(0..i-1), so every time you compute a f_(i), you’re computing EVERY f1,2(1..i-1) – (because it depends on their value).

    For this reason, the number of times you compute f_(i) depends on how many f1,2 there are “above him”.

    Hope that’s clear.

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

Sidebar

Related Questions

I have been reading this link from Steven Sanderson about mobile web development http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application
When reading about SQL Injection and XSS i was wondering if you guys have
When reading about pipes in Advanced Programming in the UNIX Environment, I noticed that
I was reading about static and dynamic libraries. To explore more I created three
Reading about both Linq to SQL and Entity Framework I have developed the impression
So I'm reading up about hash tables, hash functions etc. I was intrigued to
I was reading this article about Dynamic Objects in C# 4.0 . In that
Reading about the G.729 codec , I found this interesting tidbit about Comfort Noise
Reading about the Dispose pattern , I see the documentation repeatedly refer to cleaning
Reading about Kohana templates and saw something I've never seen before: $this->template->title = __('Welcome

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.