Questions about problems that entail selecting the best element from some set of available alternatives, and methods to solve them.
Questions tagged [optimization]
1871 questions
65
votes
8 answers
What is a the fastest sorting algorithm for an array of integers?
I have come across many sorting algorithms during my high school studies. However, I never know which is the fastest (for a random array of integers). So my questions are:
Which is the fastest currently known sorting algorithm?
Theoretically, is it…
gen
- 991
- 1
- 8
- 15
35
votes
7 answers
Algorithm to distribute items "evenly"
I'm searching for an algorithm to distribute values from a list so that the resulting list is as "balanced" or "evenly distributed" as possible (in quotes because I'm not sure these are the best ways to describe it... later I'll provide a way to…
moraes
- 473
- 1
- 4
- 6
33
votes
2 answers
Optimization version of decision problems
It is known that each optimization/search problem has an equivalent decision problem. For example the shortest path problem
optimization/search version:
Given an undirected unweighted graph $G = (V, E)$ and two vertices $v,u\in V$, find a…
bek
27
votes
2 answers
Selling blocks of time slots
Given $n$ time slots that $k$ people want to buy. Person $i$ has a value $h(i,j)\geq 0$ for each time slot $j$. Each person can only buy one consecutive block of time slots, which could be empty.
Is there a polynomial-time algorithm to compute the…
user11550
- 323
- 2
- 8
24
votes
2 answers
Efficient algorithm for 'unsumming' a set of sums
Given a multiset of natural numbers X, consider the set of all possible sums:
$$\textrm{sums}(X)= \left\{ \sum_{i \in A} i \,|\, A \subseteq X \right\}$$
For example, $\textrm{sums}(\left\{1,5\right\}) = \left\{0, 1, 5, 6\right\}$ while …
Uri Granta
- 343
- 1
- 6
24
votes
3 answers
Why are NP-complete problems so different in terms of their approximation?
I'd like to begin the question by saying I'm a programmer, and I don't have a lot of background in complexity theory.
One thing that I've noticed is that while many problems are NP-complete, when extended to optimization problems, some are far more…
GregRos
- 525
- 2
- 9
24
votes
5 answers
Why do low fitness individuals have a chance to survive to the next generation?
I am currently reading and watching about genetic algorithm and I find it very interesting (I haven't had the chance to study it while I was at the university).
I understand that mutations are based on probability (randomness is the root of…
Max
- 343
- 3
- 8
24
votes
2 answers
Collectively pay the bill problem
There are $n$ people at a table. The $i$th person has to pay $p_i$ dollars.
Some people don't have the right bills to pay exactly $p_i$, so they come up with the following algorithm.
First, everyone puts some of their money on the table. Then each…
Chao Xu
- 3,103
- 19
- 34
23
votes
1 answer
How fundamental are matroids and greedoids in algorithm design?
Initially, matroids were introduced to generalize the notions of linear independence of a collection of subsets $E$ over some ground set $I$. Certain problems that contain this structure permit greedy algorithms to find optimal solutions. The…
Nicholas Mancuso
- 3,927
- 1
- 25
- 39
22
votes
3 answers
Algorithm to minimize surface area, given volume
Consider the following algorithmic task:
Input: a positive integer $n$, along with its prime factorization
Find: positive integers $x,y,z$ that minimize $xy+yz+xz$, subject to the restriction that $xyz=n$
What is the complexity of this problem? Is…
D.W.
- 167,959
- 22
- 232
- 500
21
votes
1 answer
How to pack polygons inside another polygon?
I have ordered a few leather sheets from which I would like to build juggling balls by sewing edges together. I'm using the Platonic solids for the shape of the balls.
I can scan the leather sheets and generate a polygon that approximates the shape…
alecail
- 422
- 2
- 10
21
votes
4 answers
How to use a greedy algorithm to find the non-decreasing sequence closest to the given one?
You are given n integers $a_1, \ldots, a_n$ all between $0$ and $l$. Under each integer $a_i$ you should write an integer $b_i$ between $0$ and $l$ with the requirement that the $b_i$'s form a non-decreasing sequence. Define the deviation of such a…
Aden Dong
- 1,151
- 2
- 11
- 24
19
votes
3 answers
How many cookies in the cookie box? -- Tiling stars
With holiday season coming up I decided to make some cinnamon stars. That was fun (and the result tasty), but my inner nerd cringed when I put the first tray of stars in the box and they would not fit in one layer:
Almost! Is there a way they could…
Raphael
- 73,212
- 30
- 182
- 400
18
votes
6 answers
How is Dynamic programming different from Brute force
I was reading up on Dynamic Programming when I came across the following quote
A dynamic programming algorithm will examine all possible ways to
solve the problem and will pick the best solution. Therefore, we can
roughly think of dynamic…
Computernerd
- 639
- 2
- 11
- 17
18
votes
13 answers
Why do we need full-fledged workstations running massive OSes with massive software?
I've grown up with computers. While watching old computer TV programmes and documentaries and reading the news about constant issues with these modern systems -- everything from the sheer amount of change/bloat/costs to all the security and privacy…
Confused Computeruser
- 221
- 2
- 3