Forum: Computer Science 30 Days Ago |
| Replies: 8 Views: 742 For example, suppose you have a function
int f(int n) {
if (n == 0) {
return 1;
}
else {
return n * f(n-1);
}
}
We want to measure its cost. But before we do so, we'll... |
Forum: Computer Science 32 Days Ago |
| Replies: 8 Views: 742 Create a recursive formula for the time complexity and figure it out from there. |
Forum: Computer Science 34 Days Ago |
| Replies: 4 Views: 525 Hey, you're right, it is easy for me. |
Forum: Computer Science 34 Days Ago |
| Replies: 8 Views: 742 Let's look at this one. I'm going to ignore the swap for now.
Iteration2:
public static long dominoes(long x, long y){
long temp;
double koeficient = 0, faktor;
for(long i=0; i<=x+y;... |
Forum: Computer Science 34 Days Ago |
| Replies: 8 Views: 742 Addition is O(n) where n is the number of bits in the BigInteger, and multiplication depends on the algorithm used: http://en.wikipedia.org/wiki/Multiplication_algorithm . That depends on the Java... |
Forum: Computer Science Nov 6th, 2009 |
| Replies: 9 Views: 452 Search for it on Google. It's a nice language that has access to all the Java libraries. |
Forum: Computer Science Nov 5th, 2009 |
| Replies: 9 Views: 452 |
Forum: Computer Science Oct 20th, 2009 |
| Replies: 8 Views: 433 When you run a Theta(n) operation n times, it takes Theta(n^2) time to do. I mean in general if you run an operation that takes n seconds n times, it's going to take n*n seconds. |
Forum: C# Oct 19th, 2009 |
| Replies: 7 Views: 310 There's no such thing as a 'blank space.' An array with 64 elements will contain 64 elements. Some of them will be null, because that's what they were initialized with -- but that's no different... |
Forum: C# Oct 19th, 2009 |
| Replies: 7 Views: 310 The "second" file from the list? Are you saying you're expecting Sort to look at the elements of the list in some particular order? |
Forum: C# Oct 19th, 2009 |
| Replies: 7 Views: 310 If File y is null, what do you expect to happen? What is y.fsPos supposed to do when y is null? (Hint: it throws an exception.)
Apologies for the snark.
You should modify your Compare method... |
Forum: Computer Science Oct 18th, 2009 |
| Replies: 8 Views: 433 No, when n is the size of the array, resizing takes Theta(n) time because you have to copy all the elements. |
Forum: Computer Science Oct 18th, 2009 |
| Replies: 8 Views: 433 You would just write that each push and pop wolud take Theta(n) time. (And so the average time per operation is Theta(n) which is bad because we'd like it to be O(1).) |
Forum: Computer Science Oct 13th, 2009 |
| Replies: 5 Views: 367 MS Visual C++ Express. It should work.
Edit: as a stopgap, if you're short on time, you can run single-file C++ programs at http://codepad.org/ . But it's in your best interest to get a compiler... |
Forum: C# Oct 13th, 2009 |
| Replies: 9 Views: 389 First of all, again, you should be iterating i from 0 to 2, not from 1 to 3.
Second, how do you know (at the time this code runs) that gemData has been written to? If you were getting an index... |
Forum: Computer Science Oct 13th, 2009 |
| Replies: 5 Views: 367 You can compile and run the program if you want to see if it works. |
Forum: Computer Science Oct 13th, 2009 |
| Replies: 3 Views: 412 Yes, read through the Time Complexity of Algorithm thread. It's a very old thread and has practical and theoretical answers. |
Forum: C# Oct 11th, 2009 |
| Replies: 6 Views: 315 For this specific mechanism, you could make a function that converts your ArrayList to a byte[] and then passes that through an MD5 or SHA1 algorithm or whatnot. See... |
Forum: C++ Oct 8th, 2009 |
| Replies: 4 Views: 258 atoi(text[0]) will not work because atoi expects a char*, not a char. That half of NeoKyrgyz's answer was basically useless and dumb.
If you want to convert the character "c" representing the... |
Forum: DaniWeb Community Feedback Sep 26th, 2009 |
| Replies: 17 Views: 1,382 The happy police strike again. It was good knowing you serkan -- I will make it very dry for you. |
Forum: Computer Science Sep 25th, 2009 |
| Replies: 6 Views: 587 What courses are available and which ones are good depends on which school you're going to. There is a lot of variety in the ways various computer science departments teach. |
Forum: C# Sep 24th, 2009 |
| Replies: 11 Views: 575 It uses the function System.Linq.Enumerable.Where, which takes an IEnumerable<T> and a function of type Func<T, Bool> and returns an IEnumerable<T> that contains all the values for which the function... |
Forum: C# Sep 23rd, 2009 |
| Replies: 11 Views: 575 Whoops, I meant path.Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).
And if you wanted to filter the empty entries manually, you'd probably do
path.Split('\\').Where(s => s.Length... |
Forum: C# Sep 23rd, 2009 |
| Replies: 11 Views: 575 Just use path.Split('\\', StringSplitOptions.RemoveEmptyEntries). |
Forum: C# Sep 21st, 2009 |
| Replies: 10 Views: 618 You need using System.Linq; at the top of your file. |
Forum: C# Sep 20th, 2009 |
| Replies: 12 Views: 634 Except when doing joins, I prefer to avoid the LINQ syntax and just use the Enumerable extension methods directly. It makes the behavior more clear, sometimes.
If you want things grouped by X and... |
Forum: C# Sep 20th, 2009 |
| Replies: 10 Views: 618 It should work for List<Microsoft.Xna.Framework.Rectangle>, which implements IEquatable<Microsoft.Xna.Framework.Rectangle>. Maybe you're expecting the code to modify the original list object. It... |
Forum: C# Sep 19th, 2009 |
| Replies: 12 Views: 634 You can and should use v.Last() instead of v.ElementAt(v.Count()-1). Using v.Last() also only iterates through the collection once, which is sometimes something to be aware of (and sometimes a... |
Forum: C# Sep 18th, 2009 |
| Replies: 3 Views: 458 Blah blah blah, why don't you answer the question instead of linking to some reference site.
linkpraveen: if you use a List<Invoice>, for example, it's impossible to have anything in that list... |
Forum: C# Sep 9th, 2009 |
| Replies: 3 Views: 284 Instead of keeping variables first_address, second_address, and third_address, and so on, make an array of addresses and walk through the array until one succeeds or until they all have failed. |
Forum: C# Mar 17th, 2009 |
| Replies: 2 Views: 1,651 ISingleResult<T> : IEnumerable<T>, so just use System.Linq.Enumerable.ToList. |
Forum: Geeks' Lounge Mar 16th, 2009 |
| Replies: 64 Views: 3,878 |
Forum: Geeks' Lounge Mar 16th, 2009 |
| Replies: 64 Views: 3,878 My knees are now flabby so I don't need to hide them anymore.
Why the hell not? |
Forum: C# Mar 16th, 2009 |
| Replies: 2 Views: 1,384 byte is an unsigned 8-bit integer whose values range from 0 to 255.
char is a 16-bit unicode character type. If you want to represent raw streams of bytes, you'll use bytes. You could also parse... |
Forum: Geeks' Lounge Mar 16th, 2009 |
| Replies: 64 Views: 3,878 You're amazed by this? You must not be as smart as I thought you were :P |
Forum: C# Mar 16th, 2009 |
| Replies: 7 Views: 567 What do you mean, the "SQL end"? Or "the application end"? I don't understand those terms. |
Forum: C# Mar 16th, 2009 |
| Replies: 3 Views: 429 For starters, replace [1-9]+ with [1-9][0-9]*
When you use a preceding @ sign in C#, that means escape characters won't work. You can then write backslashes freely.
For example, @"C:\Documents... |
Forum: C# Mar 16th, 2009 |
| Replies: 7 Views: 567 Yes, they use databases.
When we install software on a client we have some huge SQL files that create all the tables, indexes, and restrictions that we need. |
Forum: Geeks' Lounge Mar 16th, 2009 |
| Replies: 64 Views: 3,878 |
Forum: Geeks' Lounge Mar 16th, 2009 |
| Replies: 64 Views: 3,878 Since this seems to be the narcissistic You-Tube video thread... here is mine.
http://www.youtube.com/watch?v=SkrVnfHsmK8 |