In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning.

learn more… | top users | synonyms (1)

-1
votes
1answer
86 views

Algorithm to 'segment' a number into blocks of n?

I'm not sure how to word the title properly, but the problem goes something like this: I have 5 nodes, and node 0 is the "master". User inputs a number, e.g. 100 to the master. master "splits" the ...
0
votes
0answers
82 views

Filtering out images that are in the golden ratio

My goal is to detect images that are probably in the golden ratio - by accident, because I take frames from a video that was taken without the intent of having the images in the golden ratio. My ...
2
votes
1answer
70 views

What alghorithm can I use to find the biggest subarray within a 2d array with only n different numbers?

Let's say I have a 2d array 100x100 in size, each cell in that array has a number from 1 to 50 randomly. How do I find the biggest subarray in a rectangle size in that array that has only n different ...
-2
votes
0answers
24 views

Permutations of a limited number set

Im trying to find all permutations of a 6 number set given the following limitations. The set contain 6 numbers The sum of the set equals 111 A number is in the range 1 to 36 inclusive I need to ...
0
votes
0answers
10 views

Dynamic Approach For LCA [on hold]

I reading a LCA Tutorial Where it defines P[1,N][1,logN] where P[i][j] is the 2j-th ancestor of i Why it is using logN and why 2j ancestor is used ? I did not understand it's intuition ?
0
votes
1answer
81 views

dynamic programming with memoization

I’ve a problem with a programming exercise. I hope you can help me. In this exercise I need to find out what the maximum profit is of taking pictures from several items in a park. For taking pictures ...
1
vote
2answers
93 views

Estimating run time of algorithm

For instance if i have an algorithm that is O(n2) and it will run for 10 seconds for a problem size of 1000. Now if i were to double the problem size to 2000 i want to know the approximate run time in ...
-1
votes
0answers
34 views

Visiting specific cells of an array

I am trying to implement an algorithm to fill a single dimensional array with the content of the cells from (a,b) to (c,d), (from 0 to `). How could I do this efficiently ? I can't seem to be able to ...
0
votes
1answer
39 views

Boundary traversal in binary tree

How to perform boundary traversal in binary tree using only single traversal of the tree? I am doing it in this way (not a single traversal): void printBoundary (struct node* root) { if (root) ...
1
vote
1answer
23 views

Matrix distribution to process grid

I need to write a program, which will perform LU-decomposition, etc. The problem is that I don't know about the preferred way to distribute the loaded matrix from the root process to other processes. ...
0
votes
0answers
15 views

Finding Contextual Nodes in a Knowledge Graph [migrated]

I'm currently participating in developing a knowledge graph that uses ConceptNet and a few others as its data sources. It uses the same architecture as ConceptNet namely it is stored as a hypergraph ...
-3
votes
0answers
25 views

DIstribution of unique content [closed]

I would like to distribute of unique content via web browsers. My task is have one part of content (part of movie, chapter in book, ... for example) only on one browser (end user). Another users can ...
3
votes
1answer
121 views

Algorithm to find minimal set

I have a set of sets S and I want to find a minimal set of elements M such that each set in S shares at least one element with M. S = set of sets ∀ f∈S ∃e · e∈f ∧ e∈M For example: S = {{1}, {1, 2, ...
-2
votes
0answers
24 views

NullPointerException from tring to get seperate RGB components [migrated]

I am trying to get the seperate RGB components from each element in a 2D color array,but it keeps throwing a NullPointerException and I am not sure why. It might be something small that I missed, so ...
5
votes
3answers
213 views

SQL - Algorithm for finding availability of a resource

I'm having trouble creating a mysql compatible algorithm for this. Background App with mysql, perl and JS. It's a booking system where each booking is comprised of a start, end and qty. Start and ...
0
votes
0answers
22 views

PSO – how Dimensions are set up?

I am coding a Particle Swarm Optimization in C++. I have been for days trying to understand the theory of how dimensions work in each different problem. In the many examples I have seen, all of them ...
1
vote
0answers
54 views

Traversing game state space : more search leads to bad results [migrated]

I am cross posting this question from codereview as i found that it to be non-responsive. I am trying to solve a problem which i think is TSP on a 2-D grid. So, i am trying to get the best result ...
0
votes
1answer
49 views

Algorithm Space and Time Complexity with Consideration for I/O (eg cache)

Is there an expression of performance for an algorithm or data structure that attempts to consider cache and other hardware concerns? Context: in my class we're looking at binary trees and it seems ...
30
votes
10answers
6k views

Is it reasonable to assume that any physical quantity can be represented by a 64-bit integer without overflow or underflow?

The original binary search algorithm in the JDK used 32-bit integers and had an overflow bug if (low + high) > INT_MAX ...
0
votes
2answers
87 views

MJRTY - A Fast Majority Vote Algorithm isn't work [closed]

The MJRTY algorithm sets out to solve the problem of finding the majority element in a stream (an element comprising more than 50% of the stream). Moore proposed to solve this by using only 2 pieces ...
2
votes
1answer
57 views

timed events to modulation of real-time audio

I am new very to audio programming and am having trouble figuring out the right kind of algorithm for converting control events (e.g. like MIDI) to real-time sound genesis with a buffer. At the ...
1
vote
1answer
53 views

Connected components of undirected graph

Suppose I have an undirected graph G with vertices v1...vn and edges. Right now it is in adjacency list representation. For every time moment I have as input some subset of vertices that are "active" ...
1
vote
0answers
53 views

A fast algorithm for a simple multi-objective minimization?

I have a set of n (arbitrary) integer numbers S which I want to partition into k subsets S_i each of size n/k (you can assume that k divides n). Let A be the arithmetic mean of elements of the set S. ...
3
votes
1answer
52 views

Should changes to FNV-1A's input exhibit the avalanche effect?

This is kind of related to Which hashing algorithm is best for uniqueness and speed?. In that question, the excellently written top answer notes, Randomnessification The other subjective ...
0
votes
1answer
124 views

Would adding more digits be a way to scale a order generation service? [closed]

I am working on interview questions from Amazon.com Software Development Engineer Intern Interview Questions. One of the interviewees was asked "give a scalable system design of Amazon.com's order ...
1
vote
2answers
130 views

c++11 random: why different range of int and real?

In the c++11, we now have <random> to produce random number. About uniform distributions, we have following int_distribution and double_distribution: uniform_int_distribution-produces integer ...
0
votes
2answers
113 views

What is a formal definition for an algorithm step?

Consider the following code to find the K th minimum element of an array: FindKthMin(A[], k) { A = Sort(A); return A[k]; } Could it be an algorithm without specifying the sort details? ...
1
vote
2answers
155 views

What benefit is there to using recursive binary search over iterative binary search or vice versa?

In a recent assignment for my programming 2 class we tested the efficiency of searches by populating a java ArrayList with 13,040 strings. The sequential search was obviously slower than the binary ...
0
votes
0answers
27 views

Finding the largest bundle of flagged points

I am currently working to develop a program that takes in an array of 4 columns and around 200,000 rows. Each column represents x, y, z (coordinates), and a flag denoting whether or not this point is ...
3
votes
2answers
136 views

How to iterate through all permutations of valid links between nodes

Imagine a 2D area, with a number (array) of nodes (or points) defined within it, in arbitrary (but known) positions (integer x,y coordinates), like this: From there I want to be able to, ...
0
votes
3answers
241 views

Abstraction in algorithms

I asked some questions about algorithms, and some replied they are abstract concepts, however I don't know what abstraction means for algorithms or how it applies. For objects, I know if we remove ...
3
votes
1answer
224 views

What is the most efficient / fastest way to keep a list in order?

I implemented Dijkstra's path finding algorithm in JavaScript and a big part of it involves storing the distances to nodes and fetching the smallest. The distances change often and the smallest is ...
0
votes
2answers
224 views

Is recursion a declarative approach to solve the problems?

I have noticed many problems in algorithms textbook are solved by recursion (divide and conquer, backtracking,...) As I tried to enhance my skills in writing them, I have noticed, I just need to ...
0
votes
2answers
44 views

Approaches to get stats like average latency in last N seconds

I am receiving messages with latency information (LI, {date, latency}). For statistical reasons: (I am open to approx. approaches, stats monitor will be updated in 6-60 seconds) I want to monitor ...
20
votes
10answers
2k views

Do algorithms depend on computer architectures?

I read somewhere (forgot which book it is) that algorithms are independent of computer architectures. Some even say algorithms are themselves computation (machines?)? On the other hand, books on ...
0
votes
2answers
123 views

Why is the “period of a (pseudo)random number generator” important?

I've been trying to understand (pseudo)random number generator code from various sources and the concept of the period continues to elude me. To satisfy the minimum level of understanding, I've tried ...
1
vote
1answer
70 views

Algorithm for a fast search

I am looking for an algorithm (pseudocode, R code) for my problem here. This looks like a lot to read but is actually very very easy to read, and I am just trying to be verbose. I have a list (say ...
4
votes
2answers
163 views

Number of strings containing a specific substring

I've seen numerous questions (and answers) concerning the number of binary strings (e.g "10010" containing some binary substring (e.g "00"). I'd like to know if there is a way to generalize this: ...
-1
votes
1answer
67 views

worst case comparisons for special case insertion sort [closed]

Consider an Insertion Sort with a Sentinel on n values, where every value occurs exactly twice in the input (so n must be even). So the best case input for comparisons is when the elements are ...
3
votes
3answers
257 views

“Read user input”: Could it be a step of an algorithm?

Based on this definition of algorithm from Wikipedia: In mathematics and computer science, an algorithm is a self-contained step-by-step set of operations to be performed. Algorithms exist that ...
1
vote
3answers
251 views

C# if statements

I am currently working on a C# checkers game for a university project in programming. But i have came to the point where i need to check whether a piece can be moved, or jump, but i feel like i'm ...
6
votes
3answers
164 views

number of strings, when each character must occur even times

I've been bashing my skull at this problem for some time now, and its really starting to frustrate me. The problem is: I have a set of characters, A, B, C, and D. I have to tell in how many ways a ...
0
votes
0answers
21 views

What is determinism in computer science? [migrated]

I was asked if my computer program (in Java) was deterministic. I'm wondering how could it be not? There is no such thing as a non-deterministic Java program right? Even if I use a random number ...
0
votes
1answer
59 views

Dynamic Programming Problem - To find smallest integer number 'x' which contains only digits 1's and 0's such that x mod n = 0

To design an algorithm that will output the smallest integer number 'x' which contains only digits 1's and 0's such that x mod n = 0 and x > 0..... For example: 2 divides 10 3 divides 111 4 ...
1
vote
1answer
52 views

Accuracy proportional to size

I have lists of data I'm trying to organize where the list with the least variation/most precision/closest to the average and most amount of data is most highly rated. Some of the lists are like 2000 ...
0
votes
0answers
33 views

Dispatch Algorithm for logistics - Batch assignments

basically, I'm trying to implement an algorithm that dispatches drivers to deliver batches (a batch is a collection of orders). The algorithm takes all the batches and all the drivers available, then ...
7
votes
8answers
2k views

Relation between object orientation and algorithms

As I read some algorithms textbooks, they are full of clever procedures for some problems (sorting, shortest path) or some general methods (recursive algorithms, divide and conquer, dynamic ...
2
votes
0answers
127 views
+50

Find sequences in a big data set of integers

I am working on algorithm for solving the integer factorization problem. My goal is to be able to recognize sequence in a big data set of integers. This is my premise, it based on experiments. The ...
1
vote
4answers
131 views

What do polynomial algorithms entail?

From here, I know it is that an algorithm that... ...is said to be solvable in polynomial time if the number of steps required to complete the algorithm for a given input is O(n^k) for some ...
-1
votes
2answers
108 views

Can we write algorithms without conditional statements? [closed]

Regarding turing completeness, i read that for a language/machine to be turing complete it is required that it has some sort of conditional. Consider the factorial problem, we would typically define ...