Top "Algorithm" questions

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

Counting inversions in an array

I'm designing an algorithm to do the following: Given array A[1... n], for every i < j, find all inversion …

algorithm
Hash table runtime complexity (insert, search and delete)

Why do I keep seeing different runtime complexities for these functions on a hash table? On wiki, search and delete …

algorithm data-structures hash time-complexity hashtable
Most efficient way to find smallest of 3 numbers Java?

I have an algorithm written in Java that I would like to make more efficient. A part that I think …

java performance algorithm min
How to convert a byte array to its numeric value (Java)?

I have an 8 byte array and I want to convert it to its corresponding numeric value. e.g. byte[] by = …

java algorithm bytearray numbers
What is the maximum number of edges in a directed graph with n nodes?

What is the maximum number of edges in a directed graph with n nodes? Is there any upper bound?

algorithm math graph max
Simple calculations for working with lat/lon and km distance?

Is there a simple calculation I can do which will convert km into a value which I can add to …

algorithm geometry geolocation
Most efficient way to see if an ArrayList contains an object in Java

I have an ArrayList of objects in Java. The objects have four fields, two of which I'd use to consider …

java algorithm optimization search arraylist
What is the best way to get the minimum or maximum value from an Array of numbers?

Let's say I have an Array of numbers: [2,3,3,4,2,2,5,6,7,2] What is the best way to find the minimum or maximum value …

algorithm actionscript-3 apache-flex actionscript complexity-theory
Quicksort: Choosing the pivot

When implementing Quicksort, one of the things you have to do is to choose a pivot. But when I look …

algorithm sorting pseudocode quicksort
Performing Breadth First Search recursively

Let's say you wanted to implement a breadth-first search of a binary tree recursively. How would you go about it? …

algorithm breadth-first-search