big-o

Multi-dimensional filter to eliminate "bad" items from a large table?

I have a large table of N items with M (M>=3) distinct properties per item, From this table I have to remove all items for which the same table contains an item that scores equal or better on all properties. I have an algorithm (python) that solves it already, but it is output-sensitive and has a worst case of approx. O((n²+n)/2) when n...

Algorithm complexity with input is fix-sized

I found some references about big O notation, but as far as I can understand algorithm complexity is a function of size of input data. For example, if complexity of bubble sort is O(n^2), n is the size of input array. Right? But, how can I determinate complexity of algorithm that has fixed input size and depends of values of input. For...

big O notation of this code

int ara(int dizi[], int ilk, int son, int deger) { int indeks; if ( ilk > son ) return 0; indeks = (ilk + son) / 2; if ( dizi[indeks] < deger ) return ara(dizi, indeks+1, son, deger); else if ( dizi[indeks] > deger ) return ara(dizi, ilk, indeks-1, deger); else ...

Is there any general rule on SQL query complexity Vs performance?

1)Are SQL query execution times O(n) compared to the number of joins, if indexes are not used? If not, what kind of relationship are we likely to expect? And can indexing improve the actual big-O time-complexity, or does it only reduce the entire query time by some constant factor? Slightly vague question, I'm sure it varies a lot but I...

time complexity of variable loops

hi, i want to try to calculate the O(n) of my program (in python). there are two problems: 1: i have a very basic knowledge of O(n) [aka: i know O(n) has to do with time and calculations] and 2: all of the loops in my program are not set to any particular value. they are based on the input data. ...

Determining time and space complexity

I am having some trouble determining space and time complexities. For example, if I have a tree that has a branching factor b and will have at most a depth d, how can I calculate the time and space complexities? I know they are O(b^d) and O(bd) , but my problem is how to get to those values. Thanks! ...

Big O Notation question

If I have an algorithm that takes 4n^2 + 7n moves to accomplish, what is it's O? O(4n^2)? O(n^2)? I know that 7n is cut off, but I don't know if I should keep n^2 coefficient or not. Thanks ...

Is log(n!) = Θ(n·log(n))?

This is a homework question. I'm not expecting an answer, just some guidance, possibly :) I am to show that log(n!) = Θ(n·log(n)). A hint was given that I should show the upper bound with nn and show the lower bound with (n/2)(n/2). This does not seem all that intuitive to me. Why would that be the case? I can definitely see how to...

O(1) lookup in non-contiguous memory?

Is there any known data structure that provides O(1) random access, without using a contiguous block of memory of size O(N) or greater? This was inspired by this answer and is being asked for curiosity's sake rather than for any specific practical use case, though it might hypothetically be useful in cases of a severely fragmented heap....

Algorithm analysis , Big O Notation Homework

Hi can someone explain me how to resolve this homework? (n + log n)3^n = O((4^n)/n). i think it's the same as resolving this inequality: (n + log n)3^n < c((4^n)/n)). thanks in advance ...

How do you determine the Big-O notation of a while loop?

Below is a binary search function. int search(int a[], int v, int left, int right) { while (right >= left) { int m = (left + right)/2; if (v == a[m]) return m; if (v < a[m]) right = m - 1; else left = m + 1; } return -1; } How do I determine the Big-O notation fo...

How can using strings instead of simple types like integers alter the O-notation of operations?

Proposed answer: Strings are simply arrays of characters so the O-notation will be dependent on the number of characters in the string (if the loop depends on the length of the string). In this case the O-notation wouldn't be affected because the length of the string is a constant. Any other ideas? Am I reading this question corre...

Is it possible to exclude hidden rows when searching for duplicates in Excel?

I am working on a procedure in Excel using VBA that highlights duplicate rows. The procedure evaluates the result of the worksheet function sumproduct to determine if the row has duplicates. The evaluated formula ends up looking like this: SUMPRODUCT(--(A1:A10 = A1), --(B1:B10 = B1), --(C1:C10 = C1)) So far the procedure works great,...

Understanding Big O

Given the following code, what is the complexity of 3. and how would I represent simple algorithms with the following complexities? O(n²+n) O(n²+2n) O(logn) O(nlogn) var collection = new[] {1,2,3}; var collection2 = new[] {1,2,3}; //1. //On foreach(var i in c1) { } //2. //On² foreach(var i in c1) { foreach(var j in c1) { } } ...

Complexity running times LAB and fibonacci numbers (java)

Hi, have been looking the page and lots of great people helping outhere so i have a Lab Assignment and i know i have to do a method concerning the fibonacci numbers to caclulate the number in the position n, but im not quite sure what do put inside the method i know is what i have to think about hope you can give and idea. Having trouble...

Big-O complexity of c^n + n*(logn)^2 + (10*n)^c

I need to derive the Big-O complexity of this expression: c^n + n*(log(n))^2 + (10*n)^c where c is a constant and n is a variable. I'm pretty sure I understand how to derive the Big-O complexity of each term individually, I just don't know how the Big-O complexity changes when the terms are combined like this. Ideas? Any help wo...

Find recurrence relation of this algorithm?

Assuming n=B-A+1, I need to derive the recurrence relation of this algorithm: void recurringalgorithm(int *a, int A, int B){ if (A == B){ for (int j=0;j<B;j++){ cout<<a[j]; } cout<<endl; return; } for (int i=A;i<B;i++){ dosomething(a[A],a[i]); recurringalgorithm(a,A+1,B); dosomething(a[A],a[i]);...

Find the big-O of a function

Please help me on following two functions, I need to simplify them. O(nlogn + n^1.01) O(log (n^2)) My current idea is O(nlogn + n^1.01) = O(nlogn) O(log (n^2)) = O (log (n^2)) Please kindly help me on these two simplification problems and briefly give an explanation, thanks. ...

Can the bigO of an algorithm be found programmatically by analyzing its perfs?

Note that I don't have a "problem" and I'm not looking for "another way to find the big O of my algorithm". What I'd like to know is if it would be possible write a program to which you'd pass data points that would all be perfs measurements of an algorithm for various input size: (n,time taken to solve problem for n) and that would the...

How to prove big-o relations

Hey, the title is probably a bit off, so please correct it if you know how to put it better. As a homework assignment I have been given several assignments along the following: Let f(n) and g(n) be asymptotically positive functions. Prove or disprove each of the following conjectures. a. f(n) = O(g(n)) implies g(n) = O(f(n)) Now, my...