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)

12
votes
8answers
2k views

Is there a canonical reference on algorithm design?

So every time I get an interview, I get simple problems. The problem is, I seem to make a mess of it by writing inefficient algorithms that either take too much space or time. I am really not able to ...
17
votes
6answers
2k views

Should I keep investing into data structures and algorithms?

These days, I'm investing heavily in data structures and algorithms and trying to solve some programming puzzles. I'm trying to code and solve with Java and Clojure. Am I wasting my time? should I ...
52
votes
30answers
11k views

What is your favorite whiteboard interview problem? [closed]

Just as the title says, what is your favorite whiteboard interview problem, and why has it proven effective for you? Junior, senior, Java, C, Javascript, PHP, SQL, pseudo-code, etc.
296
votes
8answers
71k views

Which hashing algorithm is best for uniqueness and speed?

I was just wondering which hashing algorithm is best for uniqueness and speed? Example (good) uses include hash dictionaries. I know there are things like sha256 and such, but these algorithms are ...
39
votes
11answers
16k views

How do I learn algorithms and data structures? [closed]

This is in continuation to my previous question where I asked is it necessary to learn algorithms and data structures. I feel yes it is. Now I work in an environment where I won't ever get the chance ...
11
votes
4answers
2k views

Algorithm for Learning development

This is a fairly general question. I know a bit of Perl and Python and I am looking to learn programming in more depth so that once I get the hang of it I can start developing applications and then ...
29
votes
5answers
1k views

I'd like to write an “ultimate shuffle” algorithm to sort my mp3 collection

I'm looking for pseudocode suggestions for sorting my mp3 files in a way that avoids title and artist repetition. I listen to crooners - Frank Sinatra, Tony Bennett, Ella Fitzgerald etc. singing old ...
21
votes
20answers
856 views

How often do you have to solve pure mathematical or algorithmical problems? [closed]

How often when you're programming do you find yourself having to solve a purely mathematical or algorithmical problem? I mean problems such as "Find the shortest path between two points in a graph", ...
16
votes
9answers
3k views

Is it essential to learn algorithms to be a real programmer?

I'm a PHP programmer, and until now I have not needed to learn algorithms... Now I'm start learning Python (a real programming language), because I need to use matplotlib. Does it make sense to start ...
10
votes
7answers
2k views

How important is studying algorithms and theory is to becoming a great programmer? [duplicate]

Possible Duplicate: Should I keep investing into data structures and algorithms? I'm a CS student. I want to become a really great programmer, what do I need to do to be come a great ...
120
votes
27answers
5k views

Simple method for reliably detecting code in text?

GMail has this feature where it will warn you if you try to send an email that it thinks might have an attachment. Because GMail detected the string see the attached in the email, but no actual ...
124
votes
13answers
8k views

Is it just me or is this a baffling tech interview question?

Background I was just asked in a tech interview to write an algorithm to traverse an "object" (notice the quotes) where A is equal to B and B is equal to C and A is equal to C. That's it. That is ...
21
votes
12answers
4k views

Do I need to understand algorithms and data structures to be called a programmer? [closed]

It has been six years since I have been coding. Coding into all kinds of things like ActionScript, JavaScript, Java, PHP, Ajax, XML HTML, ASP, etc. I have used arrays, maps, linked lists, sets, etc ...
20
votes
9answers
4k views

Easy to understand and interesting book on algorithms [duplicate]

Possible Duplicate: Recommended book about algorithms, data structures and complexity? Please advise me a book on algorithms, that would be easier to read and understand than Cormen's ...
45
votes
16answers
3k views

Is big-O really that relevant when working in industry?

In every interview I have been in, I have been quizzed on mathematical analysis of complexity, including big-O notation. My question is, how relevant is this test to development in industry? How often ...
21
votes
6answers
5k views

Can an algorithm be patented?

So can an algorithm be patented? I saw this statement which made me think: Everybody would abstain from patenting the improvements of contour dot algorithm for at least several years, say ...
11
votes
3answers
565 views

Please explain the statement that the function an+b belongs to O(n^2) and and Θ(n)?

Let's say I have a linear function f(n)= an+b, what is the best way to prove that this function belongs to O(n2) and Θ(n)? I do not need mathematical rigor here. I need a programmers answer. Some ...
4
votes
3answers
1k 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
3answers
235 views

best resource[s] to stay updated on algorithms

At University I follow 3 course about algorithms. As more and more university give to Internet program and slides about his courses. What are the best resources - university courses put on web - ...
7
votes
10answers
765 views

A better way of doing Regex? [duplicate]

I really dislike regular expressions, each time I come back to it I seem to have to relearn it. It's also incredibly hard to maintain, modify and at a glance understand what it is doing. Has anyone ...
6
votes
5answers
456 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 ...
-1
votes
3answers
278 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: ...
22
votes
9answers
6k views

Color schemes generation - theory and algorithms

I will be generating charts and diagrams and I am looking for some theory on color schemes and algorithm examples. Example questions: How to generate complementary or analogous colors? How to ...
60
votes
1answer
2k views

What task did Dijkstra give volunteers, which was mentioned in his paper “The Humble Programmer”?

In Dijkstra's paper "Humble Programmer", he mentions that he gave some volunteers a problem to solve: “I have run a little programming experiment with really experienced volunteers, but something ...
19
votes
4answers
2k views

Which algorithms and data structures should a developer absolutely know?

I want to be a successful enterprise Java developer. With what algorithms and data structures should I be well versed? What books would you recommend to me? To be a successful Java developer, do I ...
24
votes
8answers
3k views

Is the algorithm more important than the programming language?

During the current (2013) Google Code Jam contest, there was a problem that took C++ and Java people 200+ lines of code as compared to Python people that solved the same problem only using 40 lines of ...
12
votes
2answers
4k views

Best practice/Patterns for two way data synchronisation

Quite often in my work the idea of 2-way data synchronisation between database systems crops up. The classic example is two slightly different CRM systems (say, Raiser's Edge and Salesforce) and the ...
17
votes
6answers
479 views

Visiting points on a number line while minimizing a cost not related to distance

I need some help on this ACM ICPC problem. My current idea is to model this as a shortest path problem, which is described under the problem statement. Problem There are N = 1000 nuclear waste ...
10
votes
11answers
3k views

What is an algorithm?

What exactly is an algorithm, as in what does Algorithm mean? The little I understand the word, is that it's not specific to a particular language, or design pattern, rather it's one the most basic ...
9
votes
5answers
618 views

Interview puzzle on traveling on a line segment

Here's an interesting question I came upon: Let's just say on a number line of length M, where 0 < M <= 1,000,000,000, you given N (1 < N <= 100,000) integer pairs of points. In each ...
7
votes
4answers
754 views

What are the differences between algorithms using data structures and algorithms using databases?

The General Question What are the differences between algorithms using data structures and algorithms using databases? Some Context This is a question that has been bugging me for some time, and I ...
19
votes
3answers
1k views

Can you use Pi as a crude random number generator?

I recently saw this question over at math.SE. It got me thinking. Could Pi be used as a crude random number generator? I mean the results are well known(how long has pi been computed to now?) but, Pi ...
7
votes
13answers
2k views

Why is it better for a programmer to design the algorithm before starting to write the code?

Does an appropriate algorithm really help improve the quality and ultimately the efficiency of a program? Can we still produce a good quality program without the algorithm? Is an appropriate ...
12
votes
4answers
706 views

What are the algorithms behind low pause GC?

Some languages, for exemple java, introduced a low pause GC. Those GC can do most of the work without pausing the whole world. This is obviously a quite hard problem because it require to analyze the ...
6
votes
9answers
899 views

I need help with algorithms, how do I improve?

I usually do well at figuring out solutions to programming assignments but for some reason, I'm really struggling in my Algorithms class. I'm not failing but I know I can do better. When I'm ...
4
votes
2answers
5k views

Best beginners books for improving algorithms [duplicate]

Possible Duplicate: Is there a canonical reference on algorithm design? I an Electronics guy.. with a great interest on programming I am learning it myself. So, when ever I pick up a puzzle ...
4
votes
8answers
965 views

What do you consider to be the essential design patterns? And do you use them? [closed]

It seems to me that programmers have an increasingly uphill task of staying up-to-date. In my efforts to improve my programming ability, I am in search of the essential design patterns that are ...
17
votes
12answers
2k views

What should a programmer learn first: Algorithms or Design Patterns?

I have new junior programmers (new graduates) who just joined my team, some of them do not know much about algorithms and design patterns. I am not sure which one should I teach them first?
12
votes
5answers
472 views

Programmaticaly finding the Landau notation (Big O or Theta notation) of an algorithm?

I'm used to search for the Landau (Big O, Theta...) notation of my algorithms by hand to make sure they are as optimized as they can be, but when the functions are getting really big and complex, it's ...
9
votes
7answers
687 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 ...
7
votes
5answers
773 views

How do you identify “edge” cases on algorithms?

Basically how do you find out which could be your worst or best case and any other "edge" cases you might have BEFORE having them and so, how do you prepare your code for them?
3
votes
1answer
2k views

Where one can find problem sets from Facebook hacker cup?

I want to tackle them on my free time, BUt I was unable to compete and I really enjoy a good crack from time to time? Can anyone post a link or maybe even the questions themselves? Please no ...
16
votes
4answers
3k views

In pseudo code what does := mean?

The section entitled Algorithmic Implementation has the following code: // Return RC low-pass filter output samples, given input samples, // time interval dt, and time constant RC function ...
11
votes
2answers
711 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
7answers
398 views

Refactoring While Programming

When posed with a problem, particularly when it is complicated in nature, I try to take some time to think about the approach I am going to take to solve the problem. Despite this, what often happens ...
12
votes
6answers
395 views

When to prefer a generalized solution over solving specific cases

In programming we're often faced with a choice: cover each conceivable use case individually, or solve the general problem: Its obvious that solving the immediate problem is faster, however ...
10
votes
6answers
1k views

Is it inefficient to concatenate strings one at a time?

I recall back from my days of programming in C that when two strings are joined, the OS must allocate memory for the joined string, then the program can copy all the string text over to the new area ...
9
votes
3answers
2k views

Why isn't Radix Sort used more often?

It's stable and has a time complexity of O(n). It should be faster than algorithms like Quicksort and Mergesort, yet I hardly ever see it used.
5
votes
4answers
137 views

What are some common algorithm optimization opportunities - mathematical or otherwise

What are some common algorithmic optimization opportunities that everyone should be aware of? I have recently be revising/reviewing some code from an application, and noticed that it appeared to be ...
5
votes
1answer
343 views

Why would I care about the asymptotic growth of the lower bound of the worst case time/space?

In mathematics, there are notations for asymptotic lower bounds, upper bounds, and tight (within-a-constant-factor) bounds. When describing the growth of functions in general, it makes sense that all ...

1 2