Question
Algorith Analysis Question we want to make a stamp collection album. There are a total of n distinct stamps available for us to buy in
Algorith Analysis Question
we want to make a stamp collection album. There are a total of n distinct stamps available for us to buy in town, numbered with integers from 0 to n 1. There are two stores in the town, namely A and B that sells stamps and all n stamps are available in both stores. Store A sells stamp i for a[i ] dollars, where store B sells the same for b[i ] dollars. we can spend at most x dollars in store A and at most y dollars in store B. we want to buy as many different stamps as he can given budget constraint. Notice that we will not buy two copies of the same stamp.
give an algorithm with; Two integer arrays a[0, . . . ,n1] and b[0, . . . ,n1] of size n such that for each i , a[i ] and b[i ] represent the cost of buying stamp i from store A and store B, respectively. Two integers x and y that represent the amount of money can spend in store A and store B, respectively. Algorithm should return the maximum number of distinct stamps can buy with money. The running time of your algorithm should be O(n x y).
I would be very grateful if you could explain it step by step.
Thanks in advance.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started