Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change bottom up implementation #229

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rodferro
Copy link

@rodferro rodferro commented Feb 24, 2018

Inputs don't need to be sorted, but we have to change how the bottom up implementation populates the results array.

We can also simplify some of the statements by:

  1. removing the call to list when we create the list 'items', as there's no need for it;
  2. initializing the list items with zeros; and
  3. removing the if statement in the nested loop, since it's not necessary anymore because of no. 2.

We have to change the test too. We can't hardcode the labels to indices because they may be in a different position.

Inputs don't need to be sorted, but we have to change how the bottom up implementation populates the results array.

We can also simplify some of the statements by:

1) removing the call to list when we create the list 'items', as there's no need for it;
2) initializing the list items with zeros; and
3) removing the if statement in the nested loop, since it's not necessary anymore because of donnemartin#2.

We have to change the test too. We can't hardcode the labels to indices because they may be in a different position.
Range has to start at 1, otherwise, during the first row iteration, we're going to get values from the last row of table T (T[-1]).
We can simplify the insert method by removing the nested conditionals.
@rodferro rodferro changed the title Refactor code Change bottom up implementation Mar 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants