Questions tagged [bottom-up]

84 questions
9
votes
2 answers

Find k out of n subset with maximal area

I have n points and have to find the maximum united area between k points (k <= n). So, its the sum of those points area minus the common area between them. ]1 Suppose we have n=4, k=2. As illustrated in the image above, the areas are calculated…
7
votes
1 answer

Grammar: difference between a top down and bottom up? (Example)

This is a follow up question from Grammar: difference between a top down and bottom up? I understand from that question that: the grammar itself isn't top-down or bottom-up, the parser is there are grammars that can be parsed by one but not the…
sixtyfootersdude
  • 25,859
  • 43
  • 145
  • 213
6
votes
2 answers

Grammar: difference between a top down and bottom up?

What is the difference between a top down and bottom up grammar? An example would be awesome.
sixtyfootersdude
  • 25,859
  • 43
  • 145
  • 213
5
votes
1 answer

How to fill a knapsack table when using recursive dynamic programming

* NOT HOMEWORK * I have implemented the knapsack in python and am successfully getting the best value however I would like to expand the problem to fill a table with all appropriate values for a knapsack table of all weights and items. I've…
5
votes
3 answers

Dynamic Programming - top-down vs bottom-up

What I have learnt is that dynamic programming (DP) is of two kinds: top-down and bottom-up. In top-down, you use recursion along with memoization. In bottom-up, you just fill an array (a table). Also, both these methods use same time complexity.…
Born Again
  • 2,139
  • 4
  • 25
  • 27
4
votes
1 answer

How to stop main content re-sizing of umano AndroidSlidingUpPanel when panel is set to default panel height

I am using umano AndroidSlidingUpPanel in my Android project. Here I am using Google Map as my main content. Follow is the relevant XML file.
AnujAroshA
  • 4,623
  • 8
  • 56
  • 99
3
votes
1 answer

Android: How do I add a footer to a fullscreen scrollview?

I want the footer to be anchored at the bottom of the screen if and only if it can be anchored there without overlapping any other views. The problem is that I don't know how many views are going to be added to the header or the footer. If putting…
3
votes
2 answers

Dynamic Programming - Rod Cutting Bottom Up Algorithm (CLRS) Solution Incorrect?

For the "rod cutting" problem: Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces.…
Marko Cain
  • 328
  • 3
  • 13
3
votes
6 answers

Knapsack 0-1 path reconstruction (which items to take)

I know how to solve knapsack 0-1 problem with dynamic programming approach, but I am having troubles figuring out which items to take without compromising the complexity of O(N * C) (N items, C capacity). Any ideas (I would prefer a bottom-up…
eold
  • 5,972
  • 11
  • 56
  • 75
3
votes
1 answer

What are the problems with bottom up approach

I am not able to clearly understand the problems of bottom up approach against which Domain Driven Design advocates. Can someone please write briefly or nudge me in the write direction? What I mean is, in Sql world we have entities represented by…
VivekDev
  • 20,868
  • 27
  • 132
  • 202
3
votes
2 answers

O(n) algorithm of heapify

I'm coding a O(n) algorithm of 'heapifying' a list in Python. I can't understand why it's not working. def func(l): size=len(l) for root in range((size//2)-1,-1,-1): child = 2*root+1 #parent of child is target …
Faustus
  • 267
  • 4
  • 8
3
votes
3 answers

Positioning AndroidSlidingUpPanel to a specific height

I am exploring https://github.com/umano/AndroidSlidingUpPanel library. When I slide the bottom panel, on slide complete it acquires complete screen area. Can anyone help me, How to stop the bottom panel to a certain height, for e.g. slide it till…
V A
  • 131
  • 1
  • 7
2
votes
2 answers

How can I add limited coins to the coin change problem? (Bottom-up - Dynamic programming)

I am new to dynamic programming (and C++ but I have more experience, some things are still unknown to me). How can I add LIMITED COINS to the coin change problem (see my code below - is a bit messy but I'm still working on it). I have a variable…
Alin M.
  • 33
  • 4
2
votes
1 answer

Tabulation vs Memoization for Backtracking solutions in Dynamic Programming (ex LCS)

Let’s say we approach the Longest Common Subsequence problem between two strings with Dynamic Programming using either Memoization (Top Down approach) or Tabulation (Bottom Up). My question is, which of these two methods can be altered in order to…
user12546101
2
votes
4 answers

opengl topdown<->bottomup textures?

When i load an image via FreeImage, the bits are bottom to top. My GL code expects all images to be topdown. Whats the best way to flip the image when i copy the bits to the texture?
user34537
1
2 3 4 5 6