title: Selling Apartments Recursive Definition
body: <p>my task is the following:</p>
  
  <blockquote>
    <p>A construction company has completed a new building with A apartments
    that are all available in the market. There are B potential buyers for
    these apartments.</p>
    
    <p>Given a buyer b and two arrays s; p, the value s[b] corresponds to the
    number of apartments buyer b would like to buy and p[b] corresponds to
    the money the buyer is willing to pay for the apartments. The goal of
    the company is to determine the maximum profit that it can achieve by
    selling the apartments to the appropriate buyers. Note that not all
    apartments need to be sold, and a buyer gets either all the apartments
    he asked for or none.</p>
    
    <p>Example: Assume there are 8 apartments to be sold and 4 potential
    buyers. The number of apartments that each buyer wants to buy and the
    price they are will- ing to pay are available in the arrays: s = [4;
    1; 2; 3] and p = [8; 1; 10; 9], respectively. The maximum prot that
    can be achieved is 20.
    3.1 [3 points] Assume P(b; a) is the maximum prot achieved when the requests of the rst b buyers are taken into consideration and when a
    apartments are available for sale. Give a recursive denition of P(b;
    a).</p>
  </blockquote>
  
  <p>Does anyone of you have an idea how to solve this recursively?</p>
  
  <p>Thanks</p>