Given a simple graph (at most one edge between u-v), with no loops or parallel edges, I have to prove that max (s,t) flow is at most O(v^2 / d^2).
I understand that this is asking to prove max flow <= C* (V^2/d^2) for some positivie c. I asked my TA (teacher assistant) and he said that we’d need to prove this by contradiction
Assume for a contradiction, there’s more than one edge between some vertices x and y. The shortest path is distance ‘d’. I’m stuck after this. In other words, I need to show that the minimum cut cannot be > v^2 / d^2
I often find it frustrating how few spells sorcerers have. This has led me to trying to increase the number of spells they have with a few multiclassing dips. I was then inspired to ask this question:
What is the maximum number of spells known a character can have?
I want this to be achieved primarily through multiclassing, so there are a few restrictions:
- The spells must be cast using Charisma as the spellcasting modifier, so multiclassing into Wizard or Druid doesn’t help;
- I’m not including features you’d get through subclasses (i.e. Eyes of the Dark gives you darkness for free), since I want this solution to be a template I can stick any subclasses onto;
- A bard’s Magical Secrets is allowed, since that’s a base class feature, but Additional Magical Secrets is not, since that’s Lore bard only;
- Feats are allowed, but Epic Boons and magic items are not;
- I’ll allow Unearthed Arcana for this one, for example UA feats;
- The spells known must be cast via your spell slots that you have via your class features;
- Polymorphing into something else that can cast spells is not allowed;
- Assume a level 20 character, and whatever ability scores are necessary (although I imagine that’ll just be Charisma 20);
- Also note that this question has nothing to do with the number of spell slots, only spells known.
Can someone tell me which is the best algorithm for minimum cost maximum flow (and easy to implement) and from where to read will be helpful . I searched online and got names of many algorithms and unable to decide which one to study .
This was asked by Amazon in their campus dive.
Consider there is a city with $ n$ residents who are in need of internet and there are $ m$ internet providers in the city. Here in the city every resident needs internet and every resident knows what providers are available to him. Formally let resident $ i$ has list of providers $ a_i$ . Also each provider has a maximum number of connections he can give, that is, provider $ i$ can have at max $ k_i$ connections. Find the optimal way of providing internet so that the number of residents having internet is maximum.
My thoughts on the question is that this question looks like a derivative of knack-pack problem with constraints, which suggests dynamic programing but i am unable to find the states. Could anyone help me?
I’m making an appearance in a friend’s game as a visiting mercenary and I’d like for my character to make an impression. I was thinking about putting 5 levels into Battle Master Fighter to be able to get the sharpshooter feat, and then putting 2 levels into war cleric to get the +10 to offset sharpshooter, but I’m wondering if there are even greater heights of possible maximization that I’m missing.
Simulacrum seems like a very powerful spell. I’m assuming from this part of the description:
Otherwise, the illusion uses all the statistics of the creature it duplicates
that the duplicate gets all my known spells and spell slots.
So let’s assume that I have all the material components (which are very expensive). If I cast Simulacrum, have the duplicate cast Simulacrum and continue doing that, what would my limit be?
Would my limit be how many times I can halve my health?:
It appears to be the same as the original, but it has half the creature’s hit point maximum
If not, what is the maximum number of duplicates I can create with Simulacrum?
(Note that I know if I cast Simulacrum more than once the illusion disappears, but I believe having the copy cast the spell itself will bypass this.)
Consider a modified Knapsack Problem where:
- The number of items to be included is fixed.
- The value of each item is equal to its weight.
Therefore, given a set of numbers, a threshold and the number of items to use (n), I want to get the subset of n numbers that produces the highest sum below the given threshold.
Having already asked this question a year ago and not being able to fully understand the given answers, this time I’m asking for something a little different. The dynamic programming solution to the 0-1 Knapsack Problem only became clear to me when I got to see the recursive approach first:
def knapsack(w, ws, vs, n): # if num of items or weight left is 0 value is 0 if n == 0 or w == 0: return 0 # if item doesn't fit return best val without item if ws[n - 1] > w: return knapsack(w, ws, vs, n - 1) # otherwise, return max of best vals with and without item include = knapsack(w - ws[n - 1], vs, w, n - 1) + v[n - 1] not_include = knapsack(w, vs, w, n - 1) return max(include, not_include)
So, if I were to solve my problem using a recursive approach (for educational purposes), what would that look like? And optionally, how would it be translated to a dynamic programming solution?
I have an undirected weighted graph without multi edges. All the edge weights are whole numbers and known. I want to know in how many ways node values(node values are also whole numbers) can be assigned to the nodes such that the graph satisfies the condition that for every edge its edge weight is exactly equal to maximum of two node values this edge is incident on.
Let $ G = (V, E)$ be an undirected graph and $ U \subseteq V$ some subset of its vertices. An induced graph $ G[U]$ is graph created from $ G$ by removing all vertices that are not part of the set $ U$ .
I want to find a polynomial time algorithm that has graph $ G = (V, E)$ and integer $ k$ as input and returns a maximum set $ U \subseteq V$ with largest size such that all vertices of $ G[U]$ have degree at most $ k$ .
My idea with greedy algorithm that removes vertices with largest degree or vertices connected with most vertices with degree greater than $ k$ doesn’t work.
Does anyone know how to solve this problem in polynomial time?