Skip to main content

Questions tagged [algorithm-analysis]

Analyzing an algorithm to determine its time and space performance.

34 votes
5 answers
16k views

In divide and conquer algorithms such as quicksort and mergesort, the input is usually (at least in introductory texts) split in two, and the two smaller data sets are then dealt with recursively. It ...
beta's user avatar
  • 1,012
32 votes
5 answers
49k views

I have the follow algorithm which finds duplicates and removes them: public static int numDuplicatesB(int[] arr) { Sort.mergesort(arr); int numDups = 0; for (int i = 1; i < arr.length; ...
chopper draw lion4's user avatar
23 votes
4 answers
4k views

What term can I use to describe something with O(N log N) complexity? For example: O(1): Constant O(log N): Logarithmic O(N): Linear O(N log N): ?????? O(N2): Quadratic O(N3): Cubic
matiascelasco's user avatar
21 votes
6 answers
5k views

I recently finished a course on advanced algorithms, and another on complexity & computability theory, and in the past few days my mind has been somewhat preoccupied by this question. Why don't we ...
cliesens's user avatar
  • 345
20 votes
8 answers
28k views

I have always heard that linear search is a naive approach and binary search is better than it in performance due to better asymptotic complexity. But I never understood why is it better than linear ...
Aseem Bansal's user avatar
  • 3,044
15 votes
2 answers
9k views

I am solving an algorithm question and my analysis is that it would run on O(2^sqrt(n)). How big is that? Does it equate to O(2^n)? Is it still non-polynomial time?
Gaara's user avatar
  • 261
13 votes
7 answers
8k views

I am a programmer and have just started reading Algorithms. I am not completely convinced with the notations namely Bog Oh, Big Omega and Big Theta. The reason is by definition of Big Oh, it states ...
Pradeep's user avatar
  • 313
13 votes
3 answers
1k views

I was going through the analysis of quicksort in Sedgewick's Algorithms book. He creates the following recurrence relation for number of compares in quicksort while sorting an array of N distinct ...
damon's user avatar
  • 299
9 votes
9 answers
3k views

Using Big O notation, it is clear that I should go with the more efficient approach, but I know that there is a significant cost in terms of initialization for more efficient solutions. The Problem: ...
BlueyRules's user avatar
8 votes
5 answers
18k views

Still on my quest to compress/decompress files with a Java implementation of Huffman's coding (http://en.wikipedia.org/wiki/Huffman_coding) for a school assignment. From the Wikipedia page, I quote: ...
Saturn's user avatar
  • 3,937
8 votes
1 answer
2k views

I recently implemented the Damerau-Levenshtein distance algorithm from the pseudocode on Wikipedia. I couldn't find any explanation of exactly how it works and the pseudocode uses completely ...
James Jensen's user avatar
7 votes
3 answers
15k views

We know that binary search takes O(log n) in Big O notation but if we need to run twice an algorithm of O(log n), would it be the same as O(n) in time complexity? For example, if I have a method to ...
Walter R's user avatar
  • 181
7 votes
2 answers
4k views

We read on Wikipedia > Iterative deepening depth-first search that The space complexity of IDDFS is O(bd), where b is the branching factor and d is the depth of shallowest goal. Wikipedia also gives ...
Dan Burton's user avatar
6 votes
8 answers
3k views

Programmers often talk about the time complexity of an algorithm, e.g. O(log n) or O(n^2). Time complexity classifications are made as the input size goes to infinity, but ironically infinite input ...
James C's user avatar
  • 191
6 votes
3 answers
4k views

I have written a data cleansing application which, for the most part, works well. It is not designed to handle large volumes of data: nothing more than about half a million rows. So early on in the ...
Bob Tway's user avatar
  • 3,646

15 30 50 per page
1
2 3 4 5
8