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
26 views

Unclear why this coin change algorithm works

I worked with someone yesterday from SO on getting my coin changing algorithm to work. It seems to me that, 1) first, makeChange1() calls getChange1() with the change amount... 2) getChange1() ...
0
votes
0answers
24 views

Which Algorithm to choose in pattern matching time serie?

I 've got multiple time series represented as multiple list of integers (in main memory, not in database). I need to perform a fast search, among all series, to find a specific pattern. Example, ...
4
votes
5answers
70 views

Finding recursive sum in SQL statement

I've two tables A and B like: A (id, dep_id) and B (id, amount) The data in those tables are like this A B id dep_id id amount --- ------- ---- -------- 1 2 ...
1
vote
0answers
10 views

Running trend or no trend Twitter rumor project

I'm learning about algorithms "trending topic", I have read the article by Stanislav Nikolov, Trend or No Trend: A Novel Nonparametric Method for Classifying Time Series. I tried downloading his ...
0
votes
2answers
28 views

Searching For Closest float values in an array

I have a problem trying to pick the closest float value out of an array. Here is some example data; The numbers that I will be dealing with always share this mirroring characteristic. ...
2
votes
0answers
30 views

How to identify user defined objects in an Image?

Example: If I have a list of custom objects say "Sun, Moon, Door, Fan" and I want to find these objects inside an image. Are there any standard algorithms to do such kind of a work?
6
votes
3answers
62 views

Inverse convolution of image

I have source and result image. I know, that some convolution matrix has been used on source to get result. Can this convolution matrix be computed ? Or at least not exact one, but very similar.
0
votes
0answers
27 views

Find Leftmost Line Leaving a Vertex

As part of a larger algorithm, I am traversing a set of interconnected line segments. On arriving at any vertex via a line segment, I need to find the leftmost line segment leaving from that point. ...
0
votes
0answers
21 views

Strategy for building best fit multiple regression model with time lagged variables

I am building a multiple regression model - wrapped in a function - with one dependent variable and a dozen independent variables. The reason why I am building a function is that I need to do this ...
8
votes
2answers
76 views

Algorithm to determine the highest and lowest possible finishing position of a team in a league

Not sure if this is an appropriate question for SO, but here goes: I am interested in the required logic needed to be able to calculate the highest and lowest possible finishing position of a team in ...
-3
votes
0answers
30 views

What algorithms can be used to develope a download manager software as a project? [closed]

I want to create a download manager software for my minor project. Now im preparing documentation of development of this project. So, I want to know is that any algorithms that i should/can use in my ...
1
vote
3answers
67 views

Why did this prime factorisation algorithm give the correct answer even though there is a flaw?

The problem stated to me was this: "What is the largest prime factor of the number 600851475143 ?" The program is used to find the answer was exactly this using C: #include<math.h> // for ...
1
vote
1answer
47 views

Universal Hashfunctions for string

I am trying to implement two different universal hash functions for strings. But I have the problem that sometimes the hash value is 0. With this I can“t use the hash function because I want to ...
1
vote
3answers
105 views

C++ STL set implementation

Why is the C++ set implemented as a binary tree instead of as a hashset, which can provide average case complexity of O(1) as compared to the O(log n) provided by a binary tree?
3
votes
2answers
40 views

Count or detect sprites passing from lines

I have a simulation in which thousands of agents (multi-pixel sprites) move to different directions. There are imaginary (not drawn in the space) detection lines in the simulation space, specified by ...
0
votes
2answers
29 views

Formatting a string based on Input and predefined values

I have 26 values's that i am considering as Special Symbol and are as with special delimeter "$" the value's can be from $A to $Z. Same time i have a predefined template as: I have $A,$B,$C..... ...
-2
votes
0answers
46 views

C# how to generate a unique binary sequence of numbers and recover it? [closed]

I want code that will help in generating a finite length unique binary sequence and regained the same by using some information. Generating sequence number in C# Unique number generation in C#
1
vote
2answers
60 views

How to know the number of voters where the number of candidates is larger than the number of slots

Our country recently held its election and I became interested in finding the number of voters who voted for a given position. Solving this problem for one slot positions (mayor, governor, etc.) is ...
2
votes
1answer
72 views

Map the 32bit integers into 32 bins, with 1,2,4..2^31 consecutive integers per bin

For a 32 bit integer, divide it into 32 bins of consecutive integers such that there are twice as many integers in each successive bin. The first bin contains 0, the second 0..1, etc up to 0..2^31-1. ...
3
votes
1answer
55 views

Mathematical proof for a binary tree

Iam not hiding this is a part of my homework but i've tried enough before posting here. So... I need to prove for a binary tree that a node k have its left kid on 2k and right kid on 2k + 1 position. ...
3
votes
1answer
44 views

How to order/sort a 2D table of dependencies

I'm curious if there is some higher level theory/approaches/algorithm to solving this problem I have. I'm working on a network routing problem (a proprietary radio network). By way of example, I have ...
-1
votes
1answer
71 views

whats wrong in this logic of finding longest common child of string

i came up with this logic to find longest common child of two strings of equal length but it runs successfuly only on simple outputs and fails others,pls guide me what i am doing wrong here. ...
0
votes
4answers
73 views

std::sort that also keeps track of number of unique entries at each level

Say I have a std::vector. Say the vectors contain numbers. Let's take this std::vector 1,3,5,4,3,4,5,1,6,3 std::sort<std::less<int>> will sort this into 1,1,3,3,3,4,4,5,5,6, How would ...
0
votes
0answers
65 views

Sorting distinct elements in an array

I have a number of distinct elements in an array and want to find those items first before sorting the array. I was thinking of using a hash table to find the elements, but is that possible since I ...
5
votes
1answer
85 views

Implementing a swap method for an indexable concurrent skip list

I'm implementing a concurrent skip list map based on Java's ConcurrentSkipListMap, the differences being that I want the list to allow duplicates, and I also want the list to be indexable (so that ...
3
votes
1answer
55 views

Efficient way to merge-sort data from multiple tables

I have a series of tables that contain data of similar format. I.e. a UNION would work. Conceptually you can think of it as 1 table partitioned into multiple tables. I want to get the data from all ...
-4
votes
0answers
71 views

is it good to use design pattern in single module? [closed]

I have 2 question regarding Design pattern 1) I am working on a java project which is already developed now i need to include a new module. it's spring based project so do i need (or good ...
0
votes
2answers
52 views

Finding connections in 3 vectors of string

I have written in C++ some code, which finds the shortest path between two cities connected by roads or by flights. Cities can be connected with direct flights or indirect ones. User can type flights ...
2
votes
3answers
60 views

How to find elements existing in two lists but with different indexes

I have two lists of the same length which contains a variety of different elements. I'm trying to compare them to find the number of elements which exist in both lists, but have different indexes. ...
-2
votes
0answers
30 views

Counting sort pseudo code

I need an easy way of interpreting psudo code such as the one below. Im finding it difficult to grasp a way of understanding psudo code and working out the solution of a given input with pen and paper ...
-1
votes
2answers
40 views

Artificial Intelligence for card battle based game

I want to make a game card battle based game. In this cards have specific attributes which can increase player's hp/attack/defense or attack an enemy to reduce his hp/attack/defense I am trying to ...
-1
votes
0answers
110 views

Coin change recursion, output as List of Lists and as coin amount [Not homework]

I'm trying to do the coin change problem. I'm able to output the denominations in several lists... but I'd prefer to have a counter for each denomination and list them out as several lists of ...
0
votes
2answers
47 views

Random exhaustive (non-repeating) selection from a large pool of entries

Suppose I have a large (300-500k) collection of text documents stored in the relational database. Each document can belong to one or more (up to six) categories. I need users to be able to randomly ...
0
votes
1answer
18 views

python mmap regex searching common entries in two files

I have 2 huge xml files. One is around 40GB, the other is around 2GB. Assume the xml format is something like this < xml > ... < page > < id > 123 < /id > ...
1
vote
1answer
43 views

Sliding window set

I'm looking for a way to efficiently maintain a set of values from a 1 minute sliding window from a given datastream (~100k values/sec). I'm looking for solution with at most logarithmic insertion ...
3
votes
1answer
53 views

Determine if a list of compare-and-swap instructions will sort a list of length N

Say I have a list of pairs of indices in an array of length N. I want to determine if an arbitrarily sorted list is sorted after doing for pair in pairs: if list_to_sort[pair.first] > ...
1
vote
2answers
59 views

Javascript text highlight function

Scenario I am trying to develop a Javascript text highlight function. It receives in input a text to search inside, an array of tokens to be searched, a class to wrap the found matches: var fmk = ...
-9
votes
0answers
65 views

C language code for Activity Selection greedy approach [closed]

I am looking for source code to solve Activity selection problem Share it please
-10
votes
0answers
93 views

A* single source - all destinations [closed]

1 2 3 4 5 6 7 8 s --------------- 1| c * * * * * * * 2| * * * * * * f * 3| * * a * e * * * 4| * * * * * * * * 5| * * b * y * z * 6| * * * * * * * * 7| * * * * * * * * 8| * * * * * * * * 9| * d * * * ...
2
votes
0answers
24 views

Determine main article image - HTML Agility Pack

I would like to use HTML Agility Pack to determine the main article body and then extract the main article image from it. I have noticed that most of the site webmasters have their main content ...
2
votes
3answers
81 views

Probability of death of a man moving n steps in a matrix

There is an island which is represented by square matrix nxn. A person on the island is standing at any given co-ordinates (x,y). He can move in any direction one step right, left, up, down on the ...
3
votes
1answer
48 views

Change of coordinates with glFrustum

I am trying to use glFrustum for a perspective projection and as I understand glFrustum like glOrtho can be used to modify the mapping of our desired coordinate system to real screen coordinates (as ...
-1
votes
5answers
77 views

String to unique integer hashing

I'm trying to develop a system that can change my string into a unique integral value, meaning say for example the word "account" has an encrypted numerical value of 0891 and no other word can ...
0
votes
2answers
43 views

source code snippets for creating a lookup table with insert, delete and search function

I want to construct a table with linux C each table entry has 3 fields: 1 ip/port pair, 2 a FIFO queue pointer, 3 a thread id the first entry ip/port pair is also a key for search, for this ...
0
votes
1answer
15 views

Encryption algorithm of Android Device Admin API

Does anybody know what algorithm they use when protecting an encrypted storage? I haven't found any information having read the documentation.
-5
votes
0answers
96 views

sort the numbers without inserting them onto array [closed]

#include<iostream> using namespace std; #include<stdio.h> void swap(int *a,int* b){ *a = *a + *b; *b = *a - *b; *a = *a - *b; } int main(){ int a,b,c,d; ...
-4
votes
2answers
44 views

What's the difference between big O and big Omega?

Big Omega is supposed to be the opposite of Big O, but they can always have the same value, because by definition Big O means: g(x) so that cg(x) is bigger or equal to f(x) and Big Omega means ...
1
vote
0answers
54 views

How do I use STL algorithms with ICU's iterators in C++?

I wonder how to use ICU library iterators with STL. For instance, what if we decided to output all permutations of a string? With std::string it looks like the following: #include <iostream> ...
0
votes
1answer
66 views

Caching data using collection

So, I have an issue caching data inside a java collection. When I initialize the app for the first time I use the below function like this, cacheImageAndSounds(0,6); Now once I reach the 4th ...
0
votes
1answer
23 views

Runtime of string concatenation checking algorithm

I wrote an algorithm to check whether or not a string is a concatenation of any number of strings in an array (while being able to use a string multiple times). I'm having trouble figuring out exactly ...

1 2 3 4 5 595
15 30 50 per page