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.
1
vote
1answer
13 views
What algorithm opencv GCRGAPH (max flow) is based on?
opencv has an implementation of max-flow algorithm (class GCGRAPH in file gcgraph.hpp). It's available here.
Does anyone know which particular max-flow algorithm is implemented by this class?
2
votes
2answers
27 views
How does a visitor “define a new operation” in a way that an iterator does not?
I know and use both iterators and visitors frequently, and have been using both before I even heard about Gang of Four's Design Patterns. Though the syntax is pretty different for the two patterns, I ...
1
vote
0answers
11 views
Robust Line Extraction from Image
I need to extract the Wall Edges from the following image.If I use the canny detection and hough transform (probabilistic). It gives me to many redundant and unnecessary lines. I was looking if I ...
0
votes
0answers
35 views
Double-Linked-List insert item algorithm flawed
I've writed a Double-Linked-List:
class doubled {
private:
class sublink {
private:
char data[30];
sublink *next_ptr;
sublink *previous_ptr;
friend doubled;
};
public:
sublink ...
1
vote
3answers
42 views
Efficient way to convert units from one system to another
I'm having an hard time figuring an efficient way to converts differents types of unit to various other types.
Switch cases would work, but IMO that's not an efficient way has I will have 3 ...
0
votes
0answers
14 views
Algorithm for finding corresponding database entries for fragmented OCR text
I am working on an application that reads in text from a document via Tesseract OCR and finds the corresponding document in a preselected amount of database entries (let’s say around somewhere between ...
1
vote
2answers
27 views
Calculate color that differs from background and foreground
Look at the following picture
I specified three colors: background, foreground and frame. They look OK to me. A user is able to change only background and foreground colors. How can I automatically ...
2
votes
1answer
38 views
Traverse tree based on timer
I'm trying to animate the traversal of a tree (BFS and DFS) to a JPanel using a timer and paintComponent... Kind of like so...
Right now the BFS algorithm just instantly loops through all nodes and ...
2
votes
1answer
55 views
Why is R's implementation of the Douglas-Peucker algorithm so slow?
Plotting geographical polygons is not R's strength, but it can be very rewarding if done well. I'm using data from the UK and the detail in the polygon borders is ridiculously high, making any ...
3
votes
2answers
103 views
How to find complexity of a recursion where the step is defined in terms of a cube root? [closed]
T(1) = 1
T(n) = T(n^1/3) + 1
How can I solve it? By "solve" I mean to found it's "complexity" (I don't really know how to say it in English), such as O(nlogn) ecc.
I couldn't guess the substitution ...
0
votes
2answers
63 views
What is the cost in time of this function? (Alghoritm analysis) [closed]
What is the cost in time in terms of arithmetic operations of this function (in terms of upper bounds)?
int foo(int n)
{
int i;
if (n <= 3) return 1;
else if (n > 333)
{
...
0
votes
2answers
57 views
Comparing two lists with order changes
I want to be able to compare two lists and to see if the values are in the same order.
For example if I have a table with a field and an order like :
Field -- Order
F1 -- 1
F2 -- 2
F3 -- 3
F4 -- ...
0
votes
1answer
32 views
How to calculate the permutation of a bit vector?
Given a bit vector V = (101101), and a permutation function: F(x) = (a*x + b) mod p. Where a and b are random numbers and p is a prime number. How can I calculate the permutation of the vector V? Does ...
0
votes
0answers
14 views
how to use more than two variables in collaborative filtering using Apache mahout
I want to correlate between three or more variables using Apache Mahout.How should i use these three variables? Two variables correlation is famous.
3
votes
4answers
95 views
How to fast get top N occurence items from an unsorted array in Java?
I've tried two method.
use HashMap to count every item's count, then navigate the map
HashMap<Integer, Integer> doc_counts = new HashMap<Integer, Integer>();
for (int i = 0; i < p; ...