big-o

What kind of algorithms have shortened running time for longer inputs?

Possible Duplicate: are there any O(1/n) algorithms? I've been reading up on various algorithms recently, and have gotten very used to seeing things with O([some combination of n, n^2 and log n). It seems pretty normal for algorithms to increase in running time with more input, so this doesn't really bother me, but are there man...

Big O Notation Interview Questions

What Big-O notation questions have you been asked? Did you find them to be good questions? Did the interviewer actually understand the concept? ...

Best practices for regex performance VS sheer iteration

I was wondering if there are any general guidelines for when to use regex VS "string".contains("anotherString") and/or other String API calls? While above given decision for .contains() is trivial (why bother with regex if you can do this in a single call), real life brings more complex choices to make. For example, is it better to do t...

Javascript run-time analysis

Hello, I've written a Javascript file, using jQuery, that I would like to perform run-time tests on. I've never done this before and was just curious on how to go about it. One site I visited suggested this as a measurement: var start = (new Date).getTime(); /* Run a test. */ var diff = (new Date).getTime() - start; This makes sense...

Complexity of finding all simple paths using depth first search?

Thanks to everyone replying with ideas and alternate solutions. More efficient ways of solving problems are always welcome, as well as reminders to question my assumptions. That said, I'd like you to ignore for a moment what problem I'm trying to solve with the algorithm, and just help me analyze the big-Oh complexity of my algorithm as...

Big O Notation - what are the differences?

Hi, I'm wondering what the difference between O(n^2) and O(n.log(n)) is? Thanks~ ...

Solve "Travelling salesman problem" in linear time

How do I tell a "project lead" to f--k off and learn some computer science when he tells me to do something that amounts to solving a generic Travelling salesman problem in linear time. One of his insights was: 1,000 nodes takes only 1 second then 30,000 should take 30 seconds. I'm not up to teaching combinatorics and Big O to idiots. ...

Quicksort superiority over Heap Sort

Heap Sort has a worst case complexity is O(nlog) n wnile Quicksort is O(n^2). But emperical evidences say quicksort is superior. Why is that?? ...

Hamiltonian circuit .

what is the Big-o complexity of finding a Hamiltonian circuit in a given order Markov chain using DFS? ...

Comparison Sorting Algorithm Complexity

Why is the lower bound for the time complexity of comparison-based sort algorithms O(n log n)? ...

Stuck with O notation

I am comparing two algorithms, Prim's and Kruskal's. I understand the basic concept of time complexity and when the two work best (sparse/dense graphs) I found this on the Internet, but I am struggling to convert it to English. dense graph: Prim = O(N2) Kruskal = O(N2*log(N)) sparse graph: Prim = O(N2) Kr...

what does O(N) mean

Possible Duplicate: What is Big O notation? Do you use it? Hi all, fairly basic scalability notation question. I recently recieved a comment on a post that my python ordered-list implimentation "but beware that your 'ordered set' implementation is O(N) for insertions" Which is great to know, but I'm not sure what this means. ...

Linked List insertion running time confusion...

I've tried to confirm the running time for the insertion for Linked List and it seems like there are two different answers. For inserting an element at the end of a Linked List, I would think that it would take O(n) since it has to traverse to the end of the list in order to access the tail. But some of the answers I've seen says O(1)?...

Is there any method for multiplying matrices having O(n) complexity?

I want to multiply two matrices but the triple loop has O(n3) complexity. Is there any algorithm in dynamic programming to multiply two matrices with O(n) complexity? ...

What is the BigO of linear regression?

How large a system is it reasonable to attempt to do a linear regression on? Specifically: I have a system with ~300K sample points and ~1200 linear terms. Is this computationally feasible? ...

Big-O and Cache Aware Data Structures & Algorithms

Is there someplace where I can get a Big-O style analysis / comparison of traditional data structures such as linked lists, various trees, hashes, etc vs. cache aware data structures such as Judy trees and others? ...

What is the difference between O, Ω, and Θ?

I am learning algorithm analysis. I am having trouble understanding the difference between O, Ω, and Θ. The way they're defined is as follows: f(n) = O(g(n)) means c · g(n) is an upper bound on f(n). Thus there exists some constant c such that f(n) is always ≤ c · g(n), for large enough n (i.e., n ≥ n0 for some constant n...

computer science: what is the big deal about big O notation.

How would big O notation help in my day to day c# programming? Is this just an academic exercise? ...

What are the differences between O(1) and O(2) in algorithm-analysis?

According to the definition of big O f(n) <= C*g(n)(which means f(n) = O(g(n)), it could be deduced that: f(n) <= C f(n) <= 2C I think there are no big differences between these two. What I could come up with is: f(n) = 1 - 1 / n f(n) = 2 - 1 / n C = 1 But what differs this two complexities,since both are constant complexity? Cou...

Can anyone provide a basic example of O-notation in Java?

i am trying to find limitations of o notations, i was wondering if there was a simple example that demonstrates an enahncement to a task, where version 1 is the same o notation as version 2, yet version 2 works more efficiently after the enhancement thanks ...