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)

4
votes
4answers
429 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
732 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
285 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
6k 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
520 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
459 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
228 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
746 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
911 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
2k 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 ...
1
vote
2answers
95 views

Possibility Program for number of pieces

I would like to put a program together to calculate the number of 60' pieces would be needed from a list of shorter pieces. For example, I sell rebar cut to length from our standard length of 60'-0". ...
4
votes
1answer
701 views

Random pairing algorithm

If you have a list of items and you want to randomly pair the items in the list together, what kind of algorithm would you use to do that, such that the items can only be matched to one other item.
2
votes
1answer
890 views

Best Upper Bound & Best Lower Bound of an Algorithm

I am studying for a final exam and I came past a question I had on an earlier test. The questions asks us to find the minimum value in an unsorted array of integers. We must provide the best upper ...
2
votes
2answers
620 views

Why the loops are avoided in Kruskal's algorithm?

I read Kruskal's algorithm as it's presented on Wikipedia. There, it says that it's an algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. But while going ...
2
votes
2answers
197 views

Searching for entity awareness in 3D space algorithm and data structure

I'm trying to do some huge AI system just for the fun and I've come to this problem. How can I let the AI entities know about each other without getting the CPU to perform redundant and costly work? ...
2
votes
3answers
370 views

best and most used algorithm for finding the primality of given positive number [closed]

When I was in college and as a programming language learner I wrote program for finding out prime numbers but then I never mind the program performance in terms of speed. Now after long time just ...
4
votes
2answers
2k views

Java code generation from class diagram

I'm on the way developing a Java application where user can provide a class diagram and get the corresponding Java code. I don't know how can I let the user interactively draw a class diagram in ...
-1
votes
3answers
491 views

Is using build-in sorting considered cheating in practice tests?

I am using one of the practice online judges where a practice problem is asked and one submits the answer and gets back if it is accepted or not based on test inputs. My question is the following: ...
2
votes
2answers
290 views

How can I permute pairs across a set?

I am writing a bet settling app in C# and WinForms. I have 6 selections, 4 of them have won. I know that using the following formula from Excel: ...
4
votes
1answer
2k views

booth multiplication algorithm

Is booth algorithm for multiplication only for multiplying 2 negative numbers (-3 * -4) or one positive and one negative number (-3 * 4) ? Whenever i multiply 2 positive numbers using booth algorithm ...
2
votes
1answer
430 views

Closest location - Heapify or Build-heap

So lets say we have a set of gps data points and your current location. If asked to give the closest point to your current location we can utilize a heap with the distance being the key. Now if we ...
5
votes
5answers
3k views

Can anyone help solve this complex algorithmic problem?

I got this question in an interview and I was not able to solve it. You have a circular road, with N number of gas stations. You know the amount of gas that each station has. You know the amount of ...
10
votes
3answers
5k views

Interpolation search vs Binary Search

When should I used interpolation search instead of binary search? For example, I have a sorted dataset, in what situations would I use binary search to find an item in this dataset or in which ...
17
votes
3answers
4k views

What modern alternatives to Numerical Recipes exist?

In the past, the Numerical Recipes book was considered the gold standard reference for numerical algorithms. The earliest Fortran Edition was followed by editions in C and C++ and others, bringing it ...
1
vote
1answer
974 views

Website or any material to practice algorithms that explains the solution

I know some projects and web pages for practicing algorithms like TopCoder and Project Euler. However, they just dictate the solution of a particular problem. I wonder if there is a resource, ...
4
votes
5answers
2k views

Why did visual programming never take off and what future paradigms might change that? [closed]

As the number of "visual" OS's such as Android, iOS and the promised Windows 8 are becoming more popular, it does not seem to me that we programmers have new ways to code using these new technologies, ...
8
votes
3answers
346 views

How many copies are needed to enlarge an array?

I am reading an analysis on dynamic arrays (from the Skiena's algorithm manual). I.e. when we have an array structure and each time we are out of space we allocate a new array of double the size of ...
9
votes
5answers
17k views

How to quickly search through a very large list of strings / records on a database

I have the following problem: I have a database containing more than 2 million records. Each record has a string field X and I want to display a list of records for which field X contains a certain ...
7
votes
3answers
2k views

Is there a known algorithm for scheduling tournament matchups?

Just wondering if there is a tournament scheduling algorithm already out there that I could use or even adapt slightly. Here are my requirements: A variable number of opponents belonging to a ...
4
votes
3answers
733 views

Is wikipedia a valuable resource for studying data structures? (can we call it complete?)

Can I depend on wikipedia to learn data structures fully using the list of data structures http://en.wikipedia.org/wiki/List_of_data_structures and the links they refer to? The same question for ...
4
votes
3answers
2k views

Basic premise on counting sort. How is k related to to Big Oh?

I am reading (Cormen) on counting sort. I understand the structure of the algorithm but the statement: In practice, we usually use counting sort when we have k = O(n), in which case the ...
1
vote
1answer
178 views

Is there a standard name for this search approach? [closed]

In order to create a (Lucene) query, an "incomplete" domain object is used. All properties with a value are used for the query, the rest is ignored. In the absence of a better name, we call it ...
2
votes
1answer
243 views

Best way to parse optional grammar rules?

I started to write a hand written parser just for fun. For simple rules it is working, but I have problem with the optional grammar rules. I marked the optional rules with a question mark. Here is a ...
11
votes
2answers
1k views

Converting a bounded knapsack problem to 0/1 knapsack problem

I ran across a problem where goal was to use dynamic programming (instead of other approaches). There is a distance to be spanned, and a set of cables of different lengths. What is the minimum number ...
8
votes
2answers
1k views

How is the “Pizza picking problem‍​” solved using dynamic programming techniques?

Winkler's pizza picking problem: A circular pizza pie of n slices, where slice i has area S_i i.e, the area is different for each pie piece. Eaters Alice and Bob take turns picking slices, but it ...
3
votes
4answers
130 views

How to handle “X” data sets as input

I participated in a coding competition today, and I found that almost all of the command line input our programs needed to receive would start with an integer representing the amount of data sets to ...
10
votes
5answers
1k views

Algorithm refresher. Why is heapsort an insort algorithm?

I can not see why the heapsort is considered an inplace sorting algorithm. I mean an extra data structure populated with the elements of the array to be sorted i.e. a heap, is used to assist in the ...