## Help with dynamic programming assignments (longest stem cut and / or common sequence)

I'm looking for a little direction on this homework problem. I am asked the question:

An exclusive family theater open all day has a capacity of C seats.
To use the theater, each group must make an offer. Each offer cannot be
less than a minimum amount (B) and any group can bid more than B for
increase the chances that his offer will be accepted to use the theater.

the theater director reviews the daily offerings and chooses among them
those who will maximize the daily income of theater R.

A. First, let's assess the following things that look promising
gourmet choice. Evaluate the strategy for dividing the amounts of group offers
by group size and choose the group with the largest amount per
member first. Give an example to show that this strategy does not
produce an optimal solution.

B. Write an equation which expresses the maximum income R recursively and shows the optimal substructure of this problem.

C. Draw the recursion tree from the following example. Suppose the theater capacity (C) is 15 and the minimum bid amount (B) is also \$ 15

(8 more similar problems) …

Basically, my question is how is this a dynamic programming (DP) issue? We have learned the methods of stem cutting and the longest common consequences for DP and I cannot understand how it fits into one or the other. I tried both to use sample data as well as a table later on the problem, but I am stuck as to how it is a DP problem. Wouldn't you just choose the maximum bid each time? I would appreciate any direction on this.

FWIW, here's what I have for problem A. I haven't gone past it because I don't know where to start with this specific problem.

A. Let's say we have the following table:

Group 1 2 3 4

Group size 3 5 7 9

Bundle 30 25 35 36

\$ / person 10 5 5 4

As we can see, group 1 has the highest \$ / person at \$ 10 / person, but group 4 has the highest bid and therefore the most revenue.

Posted on

## In which programming language cPanel and WHM were they created?

Do you know in which programming language cPanel and WHM were produced? … | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1803876&goto=newpost
Posted on

## programming languages ​​- Saving variable size output from a Matlab function

I am running a Matlab function which finds all cycles in a directed graph. The problem is that sometimes the function returns a vector, but sometimes it returns several vectors. In addition, the vectors are of different sizes, for example, I get:

``````findcycles(sparse(adj))
``````

years =

`````` 1     4
``````

years =

`````` 3
``````

years =

`````` 1     3     4
``````

years =

`````` 2     5
``````

Question: Is there a simple way to store all the responses of a function in an array? For example, something like: b = findcycles (sparse (adj))? Currently, I get the following error (regardless of whether b is a vector or a matrix or any other object).

``````Error using findcycles

Too many output arguments.
``````

For clarification, I write my code below. Thank you so much.

``````> function findcycles(G)
> numNodes = size(G,1);
>for n = 1:numNodes
> (D,P)=graphtraverse(G,n);
>for d = D
>        if G(d,n)
>            graphpred2path(P,d)
>        end
>end
>G(n,:)=0;
>end
``````

Posted on

## programming languages ​​- Can anyone help me with these questions?

1-What is the number of loops in the next instruction for the instruction?
for (int i = 0; i <n; i ++) {// instruction; }

a) Infinite loop

b) n

c) n – 1

d) n + 1

2-What is the returnValueType of the following method?
public static _____________ myMmethod (byte x, double y) {
return (long) x / y * 2; }

a) int

b) byte

c) long

d) double

3-What are the two acceptable data types for x?
switch (x) {
default: System.out.println ("Hello");

}
a) byte and character

b) long and short

c) char and double

d) float and int

4-What is the value of str2 after the execution of the following instructions?
String str1, str2, str3 = "Today is Wednesday.";
str1 = str3.substring (9, 18);
str2 = str1.substring (0, 3);

a) Tod

b) Sea

c) Wedn

d) East

5-What is displayed by: System.out.println ("1" + 2 + 3);

a) 6

b) 15

c) 123

d) a syntax error

Posted on

## Can I find all of the common subsequences between 2 sequences using dynamic programming?

I need to know if there is a dynamic programming algorithm that returns all the current subsequences between 2 sequences and not just the longest one.

Thank you.

Posted on

## reference request – Linear programming on a finite field

Your problem, solving a system of linear equations, can be solved using an old algorithm, Gaussian elimination, which works on all fields.

Note that linear programming is more general, also allowing inequalities. However, it is not entirely clear how the order should be defined on a finite field.

Posted on

## Does sorting accept a dynamic programming solution?

Dynamic programming is an algorithmic technique, algorithms are classified as dynamic programming according to what their high-level structure "looks like", and not according to a formal definition. If you really wanted to, you could force some sorting algorithms to integrate into the dynamic programming paradigm.

Let $$A (1: n)$$ be the array to sort, assume for simplicity that all its elements are distinct and define $$OPT (i)$$ as the sorted array containing the smallest $$i$$ elements of $$A$$.

According to this definition $$OPT (0)$$ is the empty array and, if you solve the subproblems in ascending order of $$i$$, you can combine them as follows:

$$displaystyle forall i = 1, dots, n quad quad OPT (i) = OPT (i-1) circ min_ {x in A setminus OPT (i-1)} x,$$

or $$circ$$ denotes concatenation. The optimal solution is $$OPT (n)$$. Calculate all $$OPT (i)$$ requires $$O (n)$$ time, so the total time required is $$O (n ^ 2)$$. At any time, you just need to store one $$OPT (i)$$, so the complexity of the space is $$O (n)$$.

It's essentially an ugly way to describe sorting by selection.

Posted on

## web development – Are there any philanthropic programming jobs / projects?

I'm looking for companies or projects that do philanthropic work or investigative journalism, etc … Not necessarily paid.

My expertise is:

• ASP.NET / Orleans / C # core
• Web technologies e.g. Angular, Node.js, Typescript, Scss
• Redis, Couchbase, MSSQL, MySql
• Certain infrastructures, for example Nginx, Kubernetes, Docker, Helm

No, this is not an application to research projects for which my expertise can help me! I don't know what a software engineer can do to help.

Posted on

## network programming – How to capture UDP packets in JAVA?

I'm very new to programming.
I need to write a JAVA program which can intercept UDP packets. I have written a basic UDP receiver program but I don't know how to adjust it for this purpose.

import java.io.;
import java.net.
;

``````public static void main(String() args) {
int port = args.length == 0 ? 57 : Integer.parseInt(args(0));
}

public void run(int port) {
try {
DatagramSocket serverSocket = new DatagramSocket(port);
String sendString = "polo";
byte() sendData = sendString.getBytes("UTF-8");

System.out.printf("Listening on udp:%s:%d%n",

while(true)
{
String sentence = new String( receivePacket.getData(), 0,
// now send acknowledgement packet back to sender
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length,
serverSocket.send(sendPacket);
}
} catch (IOException e) {
System.out.println(e);
}
// should close serverSocket in finally block
}
``````

}

I am not receiving any packets but I can see packets on my Ethernet port:
WireShark Snapshot

Like I said, I'm very new to programming, so excuse me if I make simple mistakes.

Posted on

## Is the cell modification history accessible by programming in Google Apps Script?

Some have a trigger installed for onEdit and a trigger installed for onChange. I save the content of the transmitted event object as below

``````function installedOnChange(e) {
var me = CalleeName(arguments);
Logger.log("%s: %s", me, JSON.stringify(e));
``````

(CalleeName is defined as

``````function CalleeName(a) {
return a.callee.toString().split(" ")(1).split("(")(0).trim();
}
``````

).

The stringification of the event contains `.oldvalue` and `.value` except if a cell is ^ C copied and then ^ V pasted into another cell. In this case, neither is given. For example, here we have the onEdit and onChange event data to copy to J19:

``````onEdit: {"authMode":"FULL","range":{"columnEnd":10,"columnStart":10,"rowEnd":19,"rowStart":19},"source":{},"triggerUid":"3504192","user":{"email":"data@blahblahblah","nickname":"data"}}

onChange: {"authMode":"FULL","changeType":"EDIT","source":{},"triggerUid":"3538611","user":{"email":"data@blahblahblah","nickname":"data"}}
``````

As you can see, no `.value` and no `.oldvalue`.

I can equate to `.value` by evaluating `e.source.getActiveCell().getValue()` however, I cannot – until now – establish previous the value of the cell was, i.e. what the destination cell contained before the collage ^ V was issued.

It occurred to me that this value might perhaps be available in Show Change History, a list available by right clicking on a cell in the sheet. However, I cannot find a programming interface for this information. Does such a thing exist? If so, how? If not, where should I post a change request?

Posted on