Skip to content

Use of dynamic programming implementation to solve common software intensive problems

Notifications You must be signed in to change notification settings

LuizGuerra/Dynamic-Programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Programming

Introduction

In this repo, there are 3 different kinds of implementations of common software-intensive problems (Fibonacci, Grid Traveler, Sum Problems and Construct Problems):

  1. Naive implementation;
  2. Dynamic implementation with memoization;
  3. Dynamic implementation with tabulation.

I couldn't find any sources only explaining tabulation, but here is a good source explaining both approaches.

More info about dynamic programming can be found here.

The study was guided by this class using JavaScript. This made me want to try to implement the same problems with different languages: Java, Swift, and Haskell. Currently, this is an ongoing project.

Problems

Fibonacci

Consists of the implementation of the Fibonacci Sequence, where, given a number, the function calculates the value of passed index into the sequence.

Grid Traveller

Given a matrix with size M and N, how many paths can you find from point (x: 0, y: 0) to (x: M, y: N), with the only possible moves being going right and down.

Sum Problems

Similar problems, but with different focuses. All 3 problems have the same 2 inputs: target number and a list of numbers. Here, we try to find if we can achieve the target number by adding numbers from the list.

  1. Can Sum: can sum numbers from the list to achieve the target number;
  2. How Sum: a sequence of numbers to be added to achieve a target number;
  3. All Sum: all possible sequence of numbers that when added, gives the target number.

Construct Problems

Similar to the Sum problems, here we have a target word to achieve and a list of substrings that we can use as we please.

  1. Can Construct: if a word can be created given a list of strings;
  2. Count Construct: how many different ways a word can be created given a list of strings;
  3. All Constructs: which different ways a word can be created given a list of strings.

Implementations

Problem Java Swift Haskell
Fibonacci Code Code -
Grid Traveler Code Code -
Sum problems Code Code -
Construct problems Code Code -

About

Use of dynamic programming implementation to solve common software intensive problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published