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)

0
votes
0answers
13 views

Polling more recent / active items more frequently

I'm setting up a service that is meant to query, via a rate-limited API, a number of posts in real-time. Now, some of these posts can be several months old, and they should really only be queried, ...
0
votes
2answers
125 views

Is there a approximate string comparison function which is odd like mathematical functions are odd?

I say odd like a mathematical function, a mathematical function is odd if f(-x) = -f(x) I understand that comparing two strings may seem to have little to do with this, because the arguments cannot ...
0
votes
0answers
38 views

Compare names and the use of Levenshtein's algorithm

I need to cross names from two lists. What is the best away to compare the names? As you may expect, in one list we can have the complete name, on the other just the first and last. Besides that, ...
0
votes
3answers
139 views

Does it really need to convert decimal,string, etc to binary?

I'm very new to programming. Just read some articles about algorithm for converting a decimal or string to binary. But,according to what I know, computers hold these data in binary form. So why don't ...
1
vote
1answer
66 views

How to count sort comparison

When it is said that this sort has M number of comparisons what does it mean? As an example: procedure bubbleSort( A : list of sortable items ) n = length(A) repeat swapped = false ...
0
votes
2answers
65 views

Average number of comparison for sort algorithms

I need to write different sort algorithms such as bubbleSort insertionSort selectionSort quickSort mergeSort And measure how many average comparison does each one for N number (averaging between ...
2
votes
0answers
61 views

Asking questions to the user based on results of previous questions

I have to select a question that would help me make me sure the user knows about a given subject. As an example, let's assume the user hasn't answered any question yet. Every question has a scope ...
2
votes
0answers
61 views

Can't figure out class scheduling issue? [on hold]

"You are a college advisor trying to help students plan their academic careers. You have the list of courses in each major and their prerequisites. Students often want to take their major courses as ...
-1
votes
0answers
63 views

How do you recognize when topological sort shoudl be used? [on hold]

What are the general properties of a programming problem that hint to the necessity of topological sort?
0
votes
0answers
45 views

Efficient all-pairs set intersection on GPU

I have n sets, subsets of a finite universe. I want to calculate the n*n matrix in which the (I, J) entry contains the cardinality of the intersection of set I and set J. n is in the order of 50000. ...
-1
votes
0answers
26 views

Rating formula including rating and number of votes [closed]

Is there any other formulas for rating calculation besides IMDB one? I have 10-stars rating TOP-100 chart, and what in that chart that for example entry with rating 9.6 and 56 number of votes would be ...
-2
votes
1answer
60 views

What do I need to parse sentence for a “simple bot” [closed]

I am developing a chat bot with Node.Js. I am trying to find efficient way to parsing sentence. what do you think about humanity -> ba bla bla. what do you think about cats ->I love cats ...
9
votes
9answers
2k views

Big O Question about an algorithm with (n^2 + n) / 2 growth rate

I'm asking this question because I am confused about one aspect regarding big O notation. I am using the book, Data Structures and Abstractions with Java by Frank Carrano. In the chapter on the ...
0
votes
0answers
94 views

What algorithm to convert an integer to unique non-linear string? [closed]

What algorithm that can be used to convert a 32-bit integer to a unique non-linear string? For example: 1 -> DGKJUFD21 2 -> IDFMSOF89 3 -> GDSJH83AS and so on.. This is linear string: 1 ...
-3
votes
0answers
37 views

Algorithm to make sum of elements equal zero [closed]

I want to make sum of elements in this array equal zero array = [[1, 2, 1], [1, 2, 1]] Need sum of columns and rows equal zero array = [[1, -2, 1], [-1, 2, 1]]
-2
votes
0answers
22 views

MATLAB: Calculating the Jacobian using feval and Newton's Method [on hold]

Problem: series of equations, each in the form 0 = Fa(i-1) - Fa(i) - k*a(i)*V F, k, V, and a0 are known. Do you have any ideas on how to calculate the jacobian using feval and how to find the ...
-1
votes
1answer
55 views

Pathfinding in a 3d world with obstacles?

What are some methods for pathfinding in a 3d world? Object X needs to move from Point A to Point B but it might have to avoid things like asteroids, planets or gas pockets that makes the object ...
3
votes
1answer
66 views

Consistent snapshot

Suppose process A has a consitent snapshot of some entities. And it is constantly receiving updates for this enteties. Now client B connecting to A and it should receive the consistent snapshot of ...
0
votes
0answers
28 views

Can't figure out how to parallelize the calculation of the amount of offspring expected for species in genetic algorithm

I developed a genetic algorithm in java 8 taking advantage of its reasonably free parallelism opportunities with Streams. As you are likely aware, running the epochs takes its time for even a test ...
1
vote
0answers
64 views

Finding the closest n points to any arbitrary point in two dimensions (r-tree, quadtree, spatial index)

I have a distribution of two dimensional point objects. How is it possible to find the nearest N number of points to any given point without iterating over the entire collection of points (and only ...
2
votes
1answer
139 views

General Way to convert a loop (while/for) to recursion or from a recursion to a loop?

This problem is mainly focusing on the algorithm, maybe something abstract and more acedemic;) The example is offering a thought, I wanna a generic way, so example is only used as to make us more ...
12
votes
2answers
406 views

Ant colony algorithm

I am a student working on an ant colony simulator for a course project. The algorithm for it is (obviously) an ant colony algorithm. I know there are various forms of the algorithm but all of those ...
0
votes
0answers
28 views

build list of possible permutations with dynamic set size

I'm trying to develop code/pseudocode to build a list of all permutations given the following data. I'm developing in a java-like language for a web app. I don't have any java libraries for this ...
0
votes
1answer
55 views

Using Euclidan Distance to intialize centroid of K-Means

I need to initialize centroid of K-Means using Euclidan distance. Is it possible? If so how the algorithm should be? I have been stuck for a while and couldn't figure it out. Thanks for your time.
0
votes
1answer
51 views

Sorting Sentences by New Words in Each

A very useful learning tool I stumbled across for Chinese was a massive list of sentences that, barring the first 10 or 15, only differed by the ones before by one or two words, or at least as few as ...
0
votes
1answer
187 views

Turn over cards in minimum number of steps

Imagine you're given an array of cards. Some of them are facing down (0), while some of them are facing up (1). Is it possible for given fixed K to turn all the cards face-up by turning over any K ...
-1
votes
3answers
143 views

How “good” are PC randomly generated variables? [closed]

I read that computers count random variables by some algorithm, so the value of the variable is predictable and is called a pseudo random variable. For real randomness one should connect a Geiger ...
0
votes
1answer
39 views

Render order of two-edge directed node graphs

I'm trying to find an algorithm for graphs with the following contents: Nodes with no edges leading out of them (shown here as a red circle) All other nodes have exactly two edges leading out ...
2
votes
1answer
38 views

equal distribution within given set of users

I have a requirement where I have a list of entity and users who that entity can be assigned E1 can be distributed by U1 or U2 E2 must be distributed by U5 E3 can be distributed by U2 ...
2
votes
2answers
255 views

What is a good algorithm to teach time complexity? [closed]

I am trying to teach my friend (who has a web development background) about algorithms. Is there a good problem that you think teaches the concept of time complexity well? It should be intuitive to ...
1
vote
0answers
72 views

GNU Simulated Annealing [migrated]

I'm working from the template program given here: https://www.gnu.org/software/gsl/manual/html_node/Trivial-example.html The program as they give it compiles and runs perfectly, which is nice. What ...
0
votes
1answer
92 views

Creating algorithms [closed]

I am a relatively new programmer. I can pick up languages and learn syntax at a speed that I consider good, but I can't figure out how to solve problems logically using algorithms very well. I know ...
0
votes
1answer
150 views

Check distance between all elements in a list of numbers in O(n*lg(n))

I have an exercise for my algorithms and data structures class, where I basically have to implement a divide and conquer algorithm or function called check_distance to determine whether all numbers in ...
0
votes
0answers
94 views

How do I search the leaves of a tree where each node could have more than two children? [migrated]

I'm trying to search the leaves of a tree data structure for a target value. My function looks like this: def searchLeaves(self, target): #DFS if len(self.children == 0): #is a leaf ...
1
vote
1answer
49 views

Image segmentation - show or hide clusters

I'm trying to make a small program in c#, that will downsample image to specified amount of colors (using K-means). Then, user will be able to hide\show colored areas(clusters) in image. I've ...
0
votes
0answers
63 views

How to search for patterns on a (game)board?

Assume a gameboard with two kinds of pieces. Let the task be to find a common patterns of pieces, namely the patterns that lead to winning. The problem is general, but the game in question is ...
1
vote
1answer
80 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...
2
votes
1answer
193 views

When designing a data structure, should I implement very inefficient operations for convenience?

(I've added the .NET tags because the data structures are for .NET, and this question should be considered in the context of the conventions for that platform.) I'm writing a library of immutable and ...
0
votes
2answers
95 views

Add file paths to database

I am scanning a directory of files and want to add them to a database. I have two variants: for file in walk(basedir): files.append(file) for file in files: add_to_database(file) versus ...
4
votes
3answers
144 views

Algorithm that generates a group of men and women who are each interested in everyone from the other gender

In my dating app, I need to compile lists of men and women where all of the men in the list are potentially interested in all of the women in the list, and vice versa. That is, in a list of 10 men ...
3
votes
2answers
196 views

How to draw rectangles for 2D arrays

I have an 2D boolean array that looks like this: [0][0][0][0][0][0][0][0][0][0] [0][0][0][0][0][0][0][0][0][0] [0][0][0][0][0][0][0][0][0][0] [0][0][0][1][1][1][0][0][0][0] ...
3
votes
3answers
509 views

How to model state of leaving/entering home

I have two sensors: One detecting if the door is open or closed, another if movement has been detected in the corridor. I want to detect if the person has left or entered home. Usually the person has ...
0
votes
1answer
107 views

What algorithm can be used to determine order given incomplete information?

Given a series of statements such as: a<c a<b b<c (Read as "a is before b", "a is before c", etc.) What is the order of the elements? In this example, the answer is a<b<c. A less ...
0
votes
2answers
190 views

What machine learning algorithm should I use to build an intelligent reminder? [closed]

I'm trying to build an intelligent reminder application for the mobile platform. I'm new to this and I'm kind of lost. So here's the problem... The application must behave like a personal assistant ...
1
vote
2answers
120 views

Efficient datastructure to create size-limited dictionary

I need a class that acts like a dictionary but will constrain the total number of key/value pairs it contains. For instance, let's say the maximum number of entries is 1000 and the class already ...
-2
votes
1answer
58 views

Find the best shuffle

I am trying to solve the following problem: Question Description: Given four integer numbers A, B, C, and D, a shuffle of them is a zero-index array, which consists of these four numbers in some ...
0
votes
1answer
64 views

How to create good positive and negative images for opencv to distinguish smiling from not smiling? [closed]

My goal is to create an opencv haar classifier xml that distinguishes between me smiling and not smiling. I created images, cut them, showing me smiling and as negatives not smiling. About 5000 ...
0
votes
0answers
62 views

Algorithm for the Simplication and Evaluation of Equations

As a new programmer messing around in python, I've been playing about with writing small programs which can calculate some of the stuff I did in maths at school. I've been trying to think of a way ...
-2
votes
2answers
88 views

Counting digits of a decimal number

Is there an algorithm to count digits of a decimal number other than saving it as a string and then looping to find the decimal point and thus count the digits?
0
votes
1answer
90 views

What's the algorithm should I use for seeing how well 2 strings match?

Suppose I have 2 strings: string1 = "home/lisa/Music/some_files/01.05 - Garden Ground.mp3" string2 = "Music/Jim Smith/Unknown/(Deluxe Version/Garden Ground).mp3" string4 = "Music/Jim Smith/Unknown/00 ...