Dynamic programming is an algorithmic technique for efficiently solving problems with a recursive structure containing many overlapping subproblems.

learn more… | top users | synonyms

1
vote
2answers
69 views

Making operations more dynamic

I am trying to build something that will allow us to configure "custom" validation for each customer. So if a customer wants to see a value contain a specific char, be specific length, or equal ...
3
votes
1answer
69 views

Determining maximum profit to be made from selling shares

Question Your algorithms have become so good at predicting the market that you now know what the share price of Wooden Orange Toothpicks Inc. (WOT) will be for the next \$N\$ days. ...
2
votes
2answers
47 views

Calculating the number of prime numbers to solve the puzzle

How can the following program execution time improved? I have used dynamic programming in both "recursive" as well as "prime" function, but I'm not getting the efficient execution time. There is ...
11
votes
6answers
1k views

Dynamic programming with Fibonacci

I have written the following code using a dynamic programming technique. Can I use ArrayList here? Please let me know if I can improve this code. ...
9
votes
1answer
63 views

Loading Data Warehouse with Dynamic SQL

For a data warehousing project I ran into the following: Custom fields that users can create, modify and delete, that should be loaded into the data warehouse as they are when the ETL happens. On ...
2
votes
1answer
27 views

Determine if subset in int array adds up to a given input integer

Given a set of non-negative integers, and a value sum, determine if there is a subset of the given set with sum equal to given sum. On similar lines, Partition problem is to determine whether a given ...
4
votes
2answers
68 views

The Three-machine proportionate flow shop problem with unequal machine

As part of an Academic project I wrote the following code, according to the algorithm (verbal). When I checked the rest of the article I notice that the efficiency should be \$O(n^2)\$ and I wrote ...
4
votes
1answer
81 views

Dynamic programming with Project Euler #18

I just wanted to get an opinion on my dynamic-programming Haskell implementation of the solution to Project Euler problem 18. The Problem: By starting at the top of the triangle below and moving ...
5
votes
2answers
82 views

How to optimise the O(m n) solution for longest common subsequence problem?

Given two strings string X of length x1 and string Y of length ...
1
vote
0answers
42 views

Three-machine proportionate flow shop problem with unequal machine

As part of an academic project I wrote a code about dynamic programming that solves the "Three-machine proportionate flow shop problem with unequal machine". My major problem is that the code takes a ...
9
votes
3answers
321 views

Optimizing “Herd Sums” problem using dynamic programming

I'm trying to solve a practice problem and all is well except for the last 2 inputs my solution is too slow. Just one loop is slowing it down I think. Herd Sums Execution Time Limit: 2 ...
0
votes
0answers
12 views

How to optimize this loop by using dynamic programming [duplicate]

I'm trying to solve a practice problem and all is well except for the last 2 inputs my solution is too slow. Just one loop is slowing it down I think. Problem: Full Solution: ...
5
votes
2answers
204 views

Finding alternating sequence in a list of numbers

Please be brutal and treat this as me coding this up for an interview. A sequence of numbers is called a zig-zag sequence if the differences between successive numbers strictly alternate between ...
7
votes
1answer
77 views

Assembly line scheduling

This is solution to the assembly line problem. Here is complete description, which is too big and verbose to re-describe. I apologize for the inconvenience of the hyperlink. Note: I do understand ...
1
vote
1answer
57 views

Knapsack 01 solution

Solution to bounded knapsack 01 problem. Once again comprehensive description is difficult in this space, refer here. Looking for code review. optimizations and best practices. ...
3
votes
2answers
66 views

Returning all the LIS of given array of int

I have this assignment where I'm supposed to code an algorithm for finding the quantity of Longest Increasing Subsequences from an array of (different) integers and print them all. I developed one ...
1
vote
1answer
207 views

MaxSum sub matrix within a matrix

Code review for best practices, optimizations, code cleanup etc. Also requesting verification of the complexity: O(row*row*col). ...
5
votes
2answers
227 views

Box-stacking problem in C++

I have tried to write code of Box stacking problem (mentioned here) in C++ . Kindly give me some views on what mistakes I might have made and how I can improve. It is running for the two inputs I have ...
2
votes
1answer
216 views

Project Euler #82 - path sum: three ways

Project Euler problem 82 asks: Here's my solution: ...
2
votes
1answer
204 views

Jump game in Java

Looking for code review, suggestions for improvement, best practices etc. The problem definiton is Jump Game Given an array start from the first element and reach the last by jumping. The ...