Questions tagged [algorithm-design]
Questions related to general, high level, techniques for the design of algorithms.
99 questions
1
vote
1
answer
124
views
Algorithm design: Model redundancy in tests
I've run across an interesting problem at work that I'm not quite sure how to grapple.
Broadly, there is a suite of of $n$ tests to ensure the quality of a product. However, the tests are both time-...
2
votes
1
answer
103
views
Seeking help in designing an algorithm
I am not a computer science nor a math person, but if given a pseudo-code or a English outline of steps. I can probably fumble my way through and write some code. I Apologize for the wall of text/...
0
votes
0
answers
65
views
What algorithm should be used to find the closest set of dates?
I have tried to outline my problem as structured as possible, here is a rough overview, I am trying to find the best matching stay for a hotel booking system. If someone inputs check in and checkout ...
2
votes
1
answer
213
views
Faster selection algorithm for small order statistics
SELECT(A,p,r,i) is an algorithm that
partitions $A[p:r]$ around the $i$ th order statistic ie. in the output, we have $l\in A[p:p+i-2]<A[p+i-1]< h\in A[p+i:...
1
vote
0
answers
98
views
How do I optimally fuse nodes in a tree structure?
I am trying to solve the following problem. I've tried to find the name of this problem, but could not really find what I was looking for. I assume there should be some graph-theory that covers it, ...
73
votes
4
answers
17k
views
What is the novelty in MapReduce?
A few years ago, MapReduce was hailed as revolution of distributed programming. There have also been critics but by and large there was an enthusiastic hype. It even got patented! [1]
The name is ...
36
votes
4
answers
5k
views
What is dynamic programming about?
Sorry in advance if this question sounds dumb...
As far as I know, building an algorithm using dynamic programming works this way:
express the problem as a recurrence relation;
implement the ...
1
vote
1
answer
178
views
3-colouring with a bounded amount of colors
The topic of 3-colouring is often talked about, but what happens if we limit the amount of times we can use one color? Take a graph $G=(V,E)$ with $k$ being the number of vertices, is it possible for ...
0
votes
2
answers
1k
views
no of times partion is called in quick sort, assuming array is always halved
In the most even possible split, PARTITION function produces two subarrays, each of size no more than n/2. since one is of size floor(n/2) and one of size ceil(n/2)-1.
The recurrence for the running ...
2
votes
2
answers
2k
views
Find all rational roots of a polynomial equation
I'm going to try to design an algorithm to find all the rational roots of a polynomial equation in range [a, b]. Can someone please tell me which algorithm currently solves the problem with lowest ...
9
votes
1
answer
24k
views
Implementation of QuickSort to handle duplicates
I have this past year question based on the following scenario:
When the list of items to be sorted contains a lot of duplicate values, we can improve QuickSort by grouping all the values that are ...
1
vote
1
answer
62
views
Beginning Algorithm Design and Proving
I know this is a general question, so you can address this by giving some examples that are specific to your field.
I want to start learning algorithm design and consequently prove its convergence. ...
0
votes
0
answers
50
views
Understanding the step in given algorithm?
I am a newbie to the world of algorithms design and currently working on a algorithm which is related to cell-phone user associating with cell-phone tower. Let $\mathcal{K} = \{1,\dots,K\}$ be set of ...
0
votes
0
answers
247
views
Algorithm question: Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1
Algorithm question:
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
Example 1:
Input: [0,1] Output: 2
Explanation: [0, 1] is the longest ...
1
vote
1
answer
815
views
Partition the indices of 2d array to minimize sum of sub-matrices
Given an $n\times n$ Matrix $M$, and the indices $[{1,2,3,4,...,n}]$ are divided into several intervals : $[1,x_1],[x_1,x_2],...[x_k,n]$, which further extract several squared sub-matrices along the $...
1
vote
0
answers
142
views
Is the minimum spanning tree a minimum-altitude connected subgraph
I'm not sure if my solution to the following problem (adapted from Exercise 20, Chapter 4 of Algorithm Design by Jon Kleinberg and Éva Tardos) is correct. I would appreciate it if anyone could point ...
0
votes
0
answers
169
views
Counting number of sequences summing to target
This is a problem that I have been struggling to understand in a theoretical computer science book I've been reading:
We call a sequence of $n$ integers $x_1, \dots, x_n$ valid if each $x_i$ is in $\{...
0
votes
1
answer
101
views
Algorithm for sorting within windows
I am writing an app which displays speeches on various topics, with each speech having a number of attributes. I want to give the user the choice to sort a list of speeches by an attribute, even ...
1
vote
0
answers
191
views
Intersection of line segments induced by point sets from fixed geometry
I am reading up on algorithms and at the moment looking at the below problem from Jeff Erickson's book Algorithms.
I solved (a) by seeing a relationship to the previous problem on computing the ...
1
vote
1
answer
127
views
"Searching and sorting" algorithm to find the natural logarithim of a number?
Yeah, this is for a homework assignment, but I hope that you'll humor me anyway. I am asked to design an algorithm that finds the natural logarithm of a number. This would be straightforward, but I'm ...
1
vote
1
answer
189
views
Multi-Path Length Minimization
I've been thinking about path planning and am trying to make good heuristics for cases with multiple agents.
Suppose there are sets $S_i$ of coordinates in $\mathbb R^2$ or $\mathbb R^3$, each of the ...
3
votes
1
answer
722
views
Can a greedy algorithm have more than one subproblems to solve after making greedy choice?
For example:
s = <s1 s2 s3> is my problem,
I make greedy choice s2 and solve s1 and <...
3
votes
1
answer
416
views
Longest substrings of common length with the same parity
Given two sequences $a$ and $b$, find largest $x$ such that in $a$ there is substring $A$ and substring $B$ in $b$ meeting those conditions:
length of both $A$ and $B$ is equal to $x$;
sum of elements ...
1
vote
1
answer
526
views
Algorithm to organize a tournament where the team componentes change each round
So, I was tasked with creating an app that generates the schedule of a doubles tennis tournament (i.e., teams of two) in a way that, by the end of it, everyone would have played against the rest of ...
2
votes
1
answer
235
views
Given an array of size n, create a sub array with given conditions using dynamic programming
We are given an array of integers of size n, which is not necessarily sorted, and we want to create a sub array. We are allowed to do one of 3 tasks below in each level:
1. skip the number in original ...