Top "Algorithm" questions

An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem.

Picking a random element from a set

How do I pick a random element from a set? I'm particularly interested in picking a random element from a …

java algorithm language-agnostic random set
Implement Stack using Two Queues

A similar question was asked earlier there, but the question here is the reverse of it, using two queues as …

algorithm data-structures stack
Insertion Sort vs. Selection Sort

I am trying to understand the differences between Insertion Sort and Selection Sort. They both seem to have two components: …

algorithm sorting insertion-sort selection-sort
Algorithm: efficient way to remove duplicate integers from an array

I got this problem from an interview with Microsoft. Given an array of random integers, write an algorithm in C …

c algorithm arrays duplicates
How to implement a binary tree?

Which is the best data structure that can be used to implement a binary tree in Python?

python algorithm search data-structures binary-tree
Quicksort with Python

I am totally new to python and I am trying to implement quicksort in it. Could someone please help me …

python algorithm sorting quicksort
Why is quicksort better than mergesort?

I was asked this question during an interview. They're both O(nlogn) and yet most people use Quicksort instead of …

algorithm sorting language-agnostic quicksort mergesort
How to find all combinations of coins when given some dollar value

I found a piece of code that I was writing for interview prep few months ago. According to the comment …

algorithm recursion puzzle coin-change
Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition

One of the most interesting projects I've worked on in the past couple of years was a project about image …

c++ algorithm image-processing opencv
Effective method to hide email from spam bots

On my homepage, I'm using this method to hide my email from spam bots: <a href="admin [at] example.…

html algorithm email spam