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)

7
votes
1answer
408 views

How do I efficiently store all OpenStreetMap data in an indexed way?

I have a PBF file that contains the following information about a country: Nodes, each with their own longitude, latitude and properties; used to store points in a 2D space. Ways, each with their ...
1
vote
1answer
340 views

Need help with algorithm for sorting list

The answer is probably obvious but not to me at this moment, so I was wondering if somebody who is better with sorting algorithms can help lead me in the right direction. This is not homework, I am ...
34
votes
13answers
4k views

Unit-testing of inherently random/non-deterministic algorithms

My current project, succinctly, involves the creation of "constrainably-random events". I'm basically generating a schedule of inspections. Some of them are based on strict schedule constraints; you ...
2
votes
1answer
415 views

Is the Leptonica implementation of 'Modified Median Cut' not using the median at all?

I'm playing around a bit with image processing and decided to read up on how color quantization worked and after a bit of reading I found the Modified Median Cut Quantization algorithm. I've been ...
2
votes
1answer
355 views

What is O(…) and how do I calculate it? [closed]

Possible Duplicate: Plain English explanation of Big O I've seen some questions here and on SO talking about the most efficient way to find or sort this or that. The questions usually talk ...
3
votes
2answers
2k views

Drawing Ellipse from a bounding box?

Does anyone know a good algorithm for drawing an ellipse from a bounding box? draw_ellipse(int s1, int s2, int s3, int s4, color c); I don't need something optimized to incomprehendable , ...
3
votes
4answers
512 views

Search algorithm with co-ordinate (x,y) hints?

I am about to start writing a UI view where many small text items are laid-out over the view and when the user hovers over a text item a dynamically-generated image is displayed (like a tooltip), ...
2
votes
5answers
441 views

Website Country Detection

I have a web crawler, and I'm looking for hints that will help me automatically detect a website country of origin. And by country of origin I generally mean the country the website is targeting. For ...
8
votes
1answer
787 views

What's the best way to learn nature-inspired algorithms? [closed]

I completed the Machine Learning course (Stanford) and got very interested, also after some research, I decided that I'd like to learn nature-inspired algorithms. I've found some resources like: ...
13
votes
3answers
7k views

Efficient graph clustering algorithm

I'm looking for an efficient algorithm to find clusters on a large graph (It has approximately 5000 vertices and 10000 edges). So far I am using the Girvan–Newman algorithm implemented in the JUNG ...
8
votes
1answer
359 views

Why is a Bayes classifier used for spam filtering?

I've been reading about Bayesian spam filtering and I think I understand the theory, but I just don't see why this approach is needed in order to calculate the likelihood of a message being spam, ...
8
votes
3answers
3k views

what techniques can be used to implement Facebook's People You May Know feature? [closed]

I'm curious to learn from a technical perspective what techniques can be used to make recommendations for e.g. Facebook's "People You May Know" (what algorithm do they use, etc.)? One of the things ...
8
votes
3answers
632 views

Is there a general method to evaluate the optimality of an optimization algorithm?

is there a general method to evaluate the optimality of an optimization algorithm, for example an algorithm solving an otherwise NP-hard or NP-complete problem? The only method I came up so far is ...
4
votes
6answers
3k views

Find all points within a certain distance of each other?

Let's say, we have... 50k points randomly allocated in 3D space, according to some volumetric function, so that in some parts of the space, points are closer together, but in other parts, they are ...
3
votes
2answers
355 views

Help on a Dynamic Programming definition in Cormen

I am reading about Dynamic Programming from Cormen. In the beginning of the chapter it says (relating to the term Dynamic Programming): "Programming” in this context refers to a tabular method, ...
4
votes
4answers
258 views

Simulating/developing_a_testing_strategy for factors that might cause the same algorithm to produce different results in Distributed Systems

This is a Purely Academic Question Context: I am working with some algorithms which are meant to arrive at a consensus in distributed systems. I intended to tackle Byzantine faults with these ...
5
votes
1answer
1k views

How to find Sub-trees in non-binary tree

I have a non-binary tree. I want to find all "sub-trees" that are connected to root. Sub-tree is a a link group of tree nodes. every group is colored in it's own color. What would be be the ...
2
votes
3answers
801 views

Algorithmic problem: Picking Cards

The problem below appeared on the last Code Sprint 2 programming competition (it's over already). The base cases are clear, but developing an algorithm that solves all possible cases has been a ...
7
votes
5answers
9k views

How to handle large numbers?

Well, I've just started doing puzzles and it's so annoying to see puzzles which are easy to do but also need to handle very large numbers. That's the problem. Say I have to deal with numbers like 10 ...
12
votes
7answers
15k views

Sort algorithms that work on large amount of data

I am looking for sorting algorithms that can work on a large amount of data, i.e. that can work even when the whole data set cannot be held in main memory at once. The only candidate that I have ...
6
votes
4answers
3k views

Smallest lexicographical rotation of a string using suffix arrays in O(n)

I will quote the problem from ACM 2003: Consider a string of length n (1 <= n <= 100000). Determine its minimum lexicographic rotation. For example, the rotations of the string “alabala” ...
0
votes
1answer
2k views

How Find operation works in a Binary Tree?

I am having a confusion in this Binary Tree Coding. I know the concept of binary tree and I know how those work and all, but in this source code i am confused with "Find" operation. I cannot ...
9
votes
6answers
600 views

Examples of general purpose algorithms that have benefited from running on a GPU? [closed]

I am looking for examples of general purpose algorithms (meaning non-graphics related) that have been proven to run an order of magnitude faster on a GPU than on a CPU. I will use these examples to ...
6
votes
3answers
1k views

Work load balance/Task distribution algorithm

I'm looking for an algorithm to either use or as a jump point for load balancing. Environment: We have ~7 job types that can be scheduled at any time by our users. Some jobs are fast, others are ...
2
votes
2answers
326 views

Concurrent Data Processing by Multiple People

Let's say I have a page, accessible by several people concurrently, that lists information that must be processed in some way by the user, after which it is either marked as "completed" and ...
4
votes
2answers
2k views

InterviewStreet (Vertical Sticks) just a tip where to get started

Having a lot of trouble with this question in interviewstreet.com: Given array of integers Y=y1,...,yn, we have n line segments such that endpoints of segment i are (i, 0) and (i, yi). Imagine that ...
1
vote
3answers
1k views

What visualization method would you recommend for event driven programs?

What visualization method would you recommend for event driven programs? Are there industry standard diagrams, such as flowcharts?
4
votes
4answers
432 views

Building a route creator

Ok, already up front, I'm going to tell you, that this is a bonus task for Data structure course I'm taking. That should take care of all the questions whether or not this is for a homework. Route ...
5
votes
3answers
2k views

What is an algorithm to find simple cycles?

I have a graph with an Eulerian cycle and no Hamiltonian cycles. I would like to divide this graph into simple cycles. Edges may not be repeated in simple cycles. How can this be done?
8
votes
7answers
2k views

What would be an appropriate algorithm to factorise numbers in the range of a few billion?

I'm learning Python at the moment and to give me reasons to apply what i'm learning I'm having a crack at some of the problems on Project Euler I'm currently on number 3, which is to determine the ...
1
vote
4answers
2k views

Beginners guide to developing optimization software [closed]

I am novice in "serious" programming i.e. applications that deal with real-life applications and software projects that go beyond school assignments. My interests include optimization, operations ...
1
vote
2answers
2k views

Determining whether two binary search trees have the same set of values

This is an interview question: Given two Binary Search Trees, write a program to determine whether they contain the same set of values. Assume there are no duplicates. My idea is to perform an ...
7
votes
3answers
747 views

Data replication patterns / algorithms

I have a series of systems that need to be distributed to a variable number of nodes (at least two, but more likely 8 - 10). For performance reasons, any one piece of state needs to be maintained in ...
10
votes
8answers
1k views

Is there a subset of programs that avoid the halting problem

I was just reading another explanation of the halting problem, and it got me thinking all the problems I've seen that are given as examples involve infinite sequences. But I never use infinite ...
8
votes
9answers
3k views

Does object-orientation really affect algorithm performance?

Object orientation has helped me a lot in implementing many algorithms. However, object-oriented languages sometimes guide you in "straightforward" approach and I doubt if this approach is always a ...
16
votes
12answers
5k views

How to write a command interpreter/parser?

Problem: Run commands in the form of a string. command example: /user/files/ list all; equivalent to: /user/files/ ls -la; another one: post tw fb "HOW DO YOU STOP THE TICKLE MONSTER?;" ...
0
votes
2answers
288 views

Worth of Algorithm Challenges and event?

I'm interested in knowing whether it is advisable for computer science students to spend their major chunk of time on the online judges practising programming(like Topcoder and codeforces) or it's ...
11
votes
7answers
8k views

If your algorithm is correct, does it matter how long it took you to write it?

I recently found out that Facebook had a programming challenge that if completed correctly you automatically get a phone interview. There is a sample challenge that asks you to write an algorithm ...
4
votes
1answer
2k views

How good is The Algorithm Design Manual 2nd edition compared to the 1st edition for a beginner?

I'm looking for a good book on algorithms and data structures for a beginner. I was reading some reviews of these two books: Introduction to Algoritms and The Algorithm Design Manual. Introduction to ...
34
votes
9answers
7k views

Why is it impossible to produce truly random numbers?

I was trying to solve a hobby problem that required generating a million random numbers. But I quickly realized, it is becoming difficult to make them unique. I picked up Algorithm Design Manual to ...
4
votes
2answers
526 views

Algorithm for the shrinking of pixel art

This is something I've been wondering about for a while - are there any algorithms out there to scale pixel art down? I'm sure we all know about the upscale versions on the Wikipedia page on Image ...
6
votes
1answer
475 views

Min cost concatenation alignment [closed]

I am doing a project on data mining. I have a very large string of size, say n and many small strings, l_1,l_2.. each of size at most m. I want to find the sequence of small strings such that their ...
5
votes
2answers
1k views

How to parallelize a sequential algorithm?

What thought process should one follow to convert a sequential algorithm to a parallel one ? Are there any specific code pattern that can be parallelized. Some patterns that I normally use are: ...
0
votes
2answers
229 views

Algorithm for searching the neighbors neighbor of a directed graph

Is there an algorithm to search a directed graph (tree) for its neighbors neighbor? My current brute-force solution works as follows: for each node n: for each child c of n for each parent ...
0
votes
1answer
213 views

How to improve my algorithm for analyzing twitters messages from users?

Hello I think I have a nice idea to implement for human kind goodness. I call it FixTheUnFixed. The idea goes like this, imagine you are driving or traveling all over the world and when you see some ...
4
votes
2answers
1k views

What is a good code pattern for single retry then error?

I am writing a routine which has the following form: TRY A IF no success, B IF no success, RETRY A IF no success, throw error It's not trivial to extract either A or B into it's own routine, so ...
11
votes
2answers
752 views

Is Dijkstra's algorithm an appropriate solution to this signal routing problem?

I'm in the process of developing a signal management and routing module for an integrated audiovisual system and am designing it with the intent of being as flexible as possible across different ...
5
votes
2answers
1k views

Algorithm for an exact solution to the Travelling Purchaser Problem

do you know of any algorithms which give an exact solution for the Traveling Purchaser Problem. I can only find heuristic and probabilistic approaches. I do have implemented a genetic algorithm so ...
5
votes
5answers
923 views

Given a set of VLSI chips, how do I determine which are good?

I have the following problem: Given n chips [note: these are VLSI chips] out of which majority of chips are good, we need to find one good chip. The only test that we can apply is on a pair of ...
6
votes
12answers
3k views

How important is learning Algorithms for high level language programmers [duplicate]

Possible Duplicate: How important is studying algorithms and theory is to becoming a great programmer? Today I learned the fast sort Algorithm. I doubt I will ever implement my own version ...