Skip to main content

Questions tagged [algorithms]

An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to design and analysis of algorithms.

2 votes
1 answer
58 views

I am failing to find the flaw in logic to a “partial” solution to the two generals problem and would appreciate help seeing where I went wrong (knowing it’s unsolvable) There are two generals A and B, ...
Colin Hicks's user avatar
0 votes
0 answers
32 views

I’m interested in knowing how the complexity of outputs relates to the programs that generate them. For example, in cellular automata like Conway’s Game of Life (a grid-based system where simple rules ...
Syed's user avatar
  • 213
-2 votes
1 answer
53 views

I'm trying to solve the following Leetcode problem: https://leetcode.com/problems/path-sum-ii/description/ This solution I came up with is working: https://pastebin.com/ma3DtU5b However, I was not ...
Platus's user avatar
  • 97
0 votes
1 answer
44 views

One of the problems that has Pseudo-polynomial time algorithm is $0/1$ Knapsack problem. The $0/1$ Knapsack problem is a follow. Given a set of $n$ elements with weights and prices, and a positive ...
Rma's user avatar
  • 163
1 vote
0 answers
28 views

I would like to solve the equation $Ax=b$ where $A$ is an $N\times N$ "cyclic" banded matrix (there might be a better term, but I wasn't able to find it), i.e. a matrix that look like $$\...
FusRoDah's user avatar
  • 111
2 votes
0 answers
53 views

I have a long array of size $n>10^6$, call it $X$. I would like to find all ranges $[a, b)$ satisfying the following conditions $\sum_{i=a}^{b-1}X[i] \leq 0$, $b-a \geq K$, $\sum_{i=a-1}^{b-1} X[i]...
cebir latis's user avatar
1 vote
0 answers
46 views

The degree of an $n$-variate polynomial is defined as the maximum degree of the monomials that composes it. Now, given a polynomial $P$ (or rather, a list of monomials, since the coefficients don't ...
Tristan Nemoz's user avatar
0 votes
1 answer
52 views

Let's say we have a term (eg an integer, but interested in symbolic polynomial as well) $t$ that can be factored as $t=p^k \cdot m$. Note: $p$ need not be necessarily prime or otherwise irreducible ...
Nikos M.'s user avatar
  • 1,038
0 votes
1 answer
44 views

Background The algorithm to calculate the n-th Fibonacci number using recursion is as follows: ...
Jianxun Zhou's user avatar
1 vote
0 answers
57 views

I'm getting stuck at choosing a fast polynomial multiplication algorithm for the last step of the AKS primality test: ...
minh quý lê's user avatar
-2 votes
0 answers
27 views

I have this request: "Design an algorithm that sums all node values within a tree and compares the result to a target value. If the sum is equal to the target, return 1; otherwise, return 0."...
Gabriele's user avatar
1 vote
0 answers
59 views

I have been trying to solve the following problem from ericksons algorithms: 20)c) Let P be a set of n points evenly distributed on the unit circle, and let S be a set of m line segments with ...
finder's user avatar
  • 11
5 votes
2 answers
161 views

First of all, I do know that it is not known whether or not $\overline{SAT}$ is in NP. But to me, it clearly looks like it is in NP. Given a Boolean formula φ with n variables, we nondeterministically ...
Aland Ameer's user avatar
-1 votes
1 answer
42 views

$$T(n) = T\big(\frac{ n}{2}\big) + \Theta(1)$$ Hi, I'm resolving this recurrence relation through Master Theorem. I would like to know my solution is correct. $\alpha = 1$ $\beta =2$, $f(n) = \Theta(...
Gabriele's user avatar
0 votes
1 answer
115 views

To compute the $n$th Fibonacci number, a recursive algorithm is as follows: ...
Rma's user avatar
  • 163

15 30 50 per page
1
2 3 4 5
786