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
votes
0answers
19 views
How to solve knapsack
I haven't good idea to solve knapsack problem.
I have:
List of product prices
Most popluar product count
Knapsack price
Knapsack length
I need get all knapsack combinations from list of products ...
0
votes
1answer
5 views
MATLAB's filtfilt() Algorithm
I'm trying to reproduce a lengthy piece of MATLAB code in another language which has no built-in equivalent of the phaseless filter, filtfilt(). I'm trying to re-cast the function in terms of simple ...
4
votes
2answers
101 views
Generating set of “N” numbers in an integer range at “logarithmic” distance in C++
I couldn't find exact answer to this question so I am posting it here:
If I have an integer range, I want to calculate "N" numbers in this range at equal logarithmic distance.
Here is a sample code ...
-7
votes
0answers
29 views
How to create java program that will compute the square root using commandline? [on hold]
Square Root:
--> Create a program that will compute the square root using commandline arguments.
NOTE: Do not use built in mathematical functions of Java. Use Algorithm on how to solve for ...
-3
votes
0answers
31 views
Am I using a “somewhat” right logic for a javascript tic tac toe game? [on hold]
I am struggling with a game of 6 in a row tic tac toe (noughts and crosses).
I don't have very good match skills nor did I learn about algos, so I am afraid I am doing it empirically and shooting in ...
-1
votes
1answer
18 views
Algo. to pick best combination out of possibilities
I have to solve following problem, basically it is to pick a best combination out of possible ones (huge) - I have to pick a best soccer team out of possible players, each player is given a score, I ...
2
votes
1answer
23 views
cost / mapping function for determining center of object based on detected features
I wrote an object tracker that will try to detect and follow a moving object in a recorded video. In order to maximize the detection rate, my algorithm is using a bunch of detection & tracking ...
0
votes
1answer
60 views
Pow-like function for negative base case
std::pow is fine for most combinations of base and exponent values.
However when the base is negative and fractional, std::pow keels over.
In the example below NaN is returned (as per definition), ...
0
votes
0answers
21 views
Compressing a Base 62(0-9a-zA-Z) encoded string
I need to compress a base62 (0-9a-zA-Z) encoded string with a length of 20 characters into a 15-16 character string in order to squeeze some other information in. The tricky part is the compressed ...
-1
votes
2answers
40 views
Find the most repeated character out of 4 strings
Let's say I have a document & the document is spread across 4 different machines, I would like to get a character which has the highest repeated count (all 4 machines combined).
One approach I ...
0
votes
0answers
23 views
Give a block of text, some keyshorts, and the target text, how to get the minimal key press to convert the text?
Suppose I have some text(code):
def text = ParamMenuable.this.linkText
def locPath: List[LocPath] = ParamMenuable.this.path
def parser = ParamMenuable.this.parser
def listToFrom(in: ...
0
votes
2answers
46 views
Implementation of Red black tree in C++ using global pointer
I am having trouble updating my global pointer in the following code,
#include <iostream>
using namespace std;
struct RB{
RB()=default;
RB(int clr):color(clr) { }
int color;
...
0
votes
1answer
30 views
Local variables in Tail recursion?
I have been reading a lot of articles about tail recursion.But i am still unclear about how the tail recursion uses no stack space.
What about the local variables and function arguments? They are ...
1
vote
0answers
44 views
better code for generating primes [migrated]
After considerable effort, I've come up with the following code to generate a list of primes of given length.
I would be very interested to see how an experienced coder would modify my code to make it ...
0
votes
0answers
29 views
Simulation Engine Algorithm [on hold]
I'm hard at work developing the core of my game and being someone that has never messed with in depth algorithms for game development I was wonder if I could get some help/tips/pointers on how to ...