I have a variable number of ArrayList's that I need to find the intersection of. A realistic cap on the number of sets of strings is probably around 35 but could be more. I don't want any code, just ideas on what could be efficient. I have an implementation that I'm about to start coding but want to hear some other ideas.
Currently, jus...
Hello :)
This is for an assignment, and is in psuedo-code.
I need to find how many integers in an array are unique, nothing else, but it has to be in O(n), preferably without hashing.
Thanks!
...
I have n=10000 10-dimensional vectors.
For every vector v1 I want to know the vector v2 that minimizes the angle between v1 and v2.
Is there a way to solve this problem faster than O(n^2)?
...
Am I wondering if the follow are true.
If f(n) is O(g(n)) and f(n) is also Ω(g(n)) that means
f(n) is also big Θ(g(n)) right? Also if either of the 2 above are false, then f(n) is not big Θ(g(n))?
...
Can someone explain this to me?
Such as this:
Given a function:
for k = 1 to lg(n)
for j = 1 to n
x=x+1
How would I analyze the tight (Θ) bound?
...
Hello, I'm still learning about complexity measurement using the Big O Notation, was wondering if I'm correct to say that following method's complexity is O(n*log4n), where the "4" is a subscript.
public static void f(int n)
{
for (int i=n; i>0; i--)
{
int j = n;
while (j>0)
j = j/4;
}
}
...
I have this method:
public static int what(String str, char start, char end)
{
int count=0;
for(int i=0;i<str.length(); i++) {
if(str.charAt(i) == start)
{
for(int j=i+1;j<str.length(); j++)
{
if(str.charAt(j) == end)
count++;
}
}
...
int a = 3;
while (a <= n)
a = a*a;
My version is that its complexity is:
Is there such a thing?
...
public void foo (int n, int m)
{
int i = m;
while (i > 100)
i = i/3;
for (int k=i ; k>=0; k--)
{
for (int j=1; j<n; j*=2)
System.out.print(k + "\t" + j);
System.out.println();
}
}
I figured the complexity would be O(logn).
That is as a product of the inner loop, the outer loop -- ...
You have an array size n and a constant k (whatever)
You can assume the the array is of int type (although it could be of any type)
Describe an algorithm that finds if there is an element(s) that repeats itself at least n/k times... if there is return one. Do so in linear time (O(n))
The catch: do this algorithm (or even pseudo-code) ...
Binary search has a average case performance as O(log n) and Quick Sort with O(n log n) is O(n log n) is same as O(n) + O(log n)
...
Hi, I have a question here the loop is:
for (i=0; i < n; ++i)
for (j = 3; j < n; ++j)
{
...
}
I kind of understand how to calculate the big-oh but I am not entirely sure on how to do it. The outer loop executes n times and the inner loop executes i times for each value of i. The complexity is sup...
Hi all..
Think the title describes my thoughts pretty well :)
I've seen a lot of people lately that swear to LINQ, and while I also believe it's awesome, I also think you shouldn't be confused about the fact that on most (all?) IEnumerable types, it's performance is not that great. Am I wrong in thinking this? Especially queries where ...
Possible Duplicate:
Plain english explanation of Big O
I'd imagine this is probably something taught in classes, but as I a self-taught programmer, I've only seen it rarely.
I've gathered it is something to do with the time, and O(1) is the best, while stuff like O(n^n) is very bad, but could someone point me to a basic expla...
What's the correct big O notation for an algorithm that runs in triangular time? Here's an example:
func(x):
for i in 0..x
for j in 0..i
do_something(i, j)
My first instinct is O(n²), but I'm not entirely sure.
...
So given the following program:
Is the time complexity of this program O(0)? In other words, is 0 O(0)?
I thought answering this in a separate question would shed some light on this question.
EDIT: Lots of good answers here! We all agree that 0 is O(1). The question is, is 0 O(0) as well?
...
Possible Duplicate:
Are there any O(1/n) algorithms?
This just popped in my head for no particular reason, and I suppose it's a strange question. Are there any known algorithms or problems which actually get easier or faster to solve with larger input? I'm guessing that if there are, it wouldn't be for things like mutations or...
Hello,
I'm solving some recurrence relation problems for Big O and so far up till this point have only encountered recurrence relations that involved this form:
T(n) = a*T(n/b) + f(n)
For the above, it's quite easy for me to find the Big O notation. But I was recently thrown a curve ball with the following equation:
T(n) = T(n-1) + ...
Anyone knows the Big O of the algorithm used in the Distinct() method, with a custom IEqualityComparer?
...
I often here people talk about Big O which measures algorithms against each other
Does this measure clock cycles or space requirements.
If people want to contrast algorithms based on memory usage what measure would they use
...