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 algorithm design.

learn more… | top users | synonyms (2)

1
vote
1answer
15 views

Graph DFS detecting cycles - (supposed) counterexample

So a DFS should detect cycles in a directed graph. If it reaches a node that has already been visited previously, i.e. it finds a back-edge, then we have a cycle. I found a graph in which I can't ...
-2
votes
2answers
28 views

Algorithm to split image into tokens

does anyone have idea how to separate particular parts of image? Let's say I have following image : I would like to extract parts of this image into something like that : I'm pretty lost, ...
0
votes
1answer
56 views

List all the possible combinations

I have a question related to the combination. I am actually developing a ecommerce site and I have a function to allow customer create product variant. For example: Black Pant 34W 30L, Black Pant ...
2
votes
1answer
32 views

closest to zero [absolute value] sum of consecutive subsequence of a sequence of real values

this is an algorithmic playground for me! I've seen variations of this problem tackling maximum consecutive subsequence but this is another variation as well. the formal def: given A[1..n] find i and ...
2
votes
1answer
22 views

Check between which points a point lies on a spline/bezier curve

Here's what I am trying to solve. I have bezier lines that contain 3 points (x1, y1), (x2, y2), (x3, y3) (that are in a 2-dimensional plane). What I am trying to figure out is if a fourth point is ...
28
votes
7answers
460 views

Is there a way to measure how sorted a list is?

It may sound like a silly question, but I'd like to know if there is a way to measure how sorted a list is. I mean, it's not about knowing if a list is sorted or not (boolean) but something like a ...
0
votes
2answers
52 views

How to generate all possibilities for triangles from 10 possible dots [closed]

I am trying to think of the solution for this problem: Generate all possibilities for triangle between 10 dots which are positioned like this: . . . . . . . . . . (like a ...
2
votes
2answers
55 views

Removing elements in a functional style

I have been struggling with something that looks like a simple algorithm, but can't find a clean way to express it in a functional style so far. Here is an outline of the problem: suppose I have 2 ...
0
votes
4answers
53 views

weighted boolean value - scaling

I am not sure how to implement this, but here is the description: Take a number as input in between the range 0-10 (0 always returning false, 10 always returning true) Take the argument which was ...
4
votes
2answers
56 views

Is there a bug in java.util.Stack's Iterator?

Today I was trying to push in util.Stack class and then use the Iterator to iterate(without using pop) through the items. I was expecting LIFO property but got surprised. Here is the code that I was ...
0
votes
3answers
59 views

Greater chance to roll 6 with dice in Java

I was wondering how can I program a dice which has a greater chance to roll a 6? I've tried everything but I just cant figure the algorithm. The probability of six is given by the user. I just don't ...
0
votes
0answers
24 views

algorithm to group items (fibre terminals) to best fit container (fibre buffer)

I have an ordered list that represents terminals on a fibre cable where each terminal has a number of ports (e.g. 4, 8, 12). Given a fibre optic cable that will supply a different fibre strand to ...
0
votes
2answers
39 views

Algo to find least amount of items that satisfy a given requirement

I want to implement an algorithm for the following problem. It later on needs to be implemented in T-SQL: I have a set of providers - lets say shops. Each shop has it set of items it offers. Some ...
1
vote
1answer
36 views

Exponentiation by cyclic shifting

Some other topic here on SO mentioned the paper “Fast Exponentiation with Precomputation” by Brickell et al., which, along with simple concept of precomputation of powers corresponding to binary ...
-1
votes
0answers
136 views

Goods reordering algorithm [closed]

I have a few warehouses in which I store goods. Unfortunately, some of the goods are in the wrong warehouses, so I need to move them to the correct ones using a truck. Loading and unloading goods ...

1 2 3 4 5 2025
15 30 50 per page