[Solved] Drunk Mandelbrot implementation [closed]

Your calculation of the complex modulus is incorrect. float Complex::getAbsoluteValue() const { return sqrt(real * real + imaginary + imaginary); } You’ve since removed this section of your post, but it should say float Complex::getAbsoluteValue() const { return sqrt(real * real + imaginary * imaginary); } solved Drunk Mandelbrot implementation [closed]

[Solved] time complexity for following function

Upto my knowledge, most common time complexity notation is Big-O, I’ll share same in this answer. Time complexity is O(1), with an assumption that Math.Pow calculation is O(1) and .ToString() method is O(1). It is O(1) because each step will be executed only once. In gerenal, if we take .ToString().Length time complexity into account then … Read more

[Solved] which code execute faster?

Given what you have posted, Example 1 int d; d=0; d=a+b; /* print d+c+e;*/ printf(“%i\n”, d+c+e); Example 2 /* print a+b+c+e; */ printf(“%i\n”, a+b+c+e); Which is faster is tricky, if your compiler optimizes d away in Example 1 they are equivalent. On the other hand, if your compiler can’t determine that d=0 is discarded (and … Read more

[Solved] What does @ mean when creating a SQL query with C#? [duplicate]

It’s a bound parameter marker. You’ll need to list all bound parameters in the Parameters collection. Using bound parameters as opposed to just constructing the SQL text directly helps with security (prevents injection attacks) and performance. solved What does @ mean when creating a SQL query with C#? [duplicate]

[Solved] How can we find number of distinct elements in a given submatrix? [closed]

It depends how many queries you can expect, and the number of identical queries you can expect. One approach is to “memoize” queries, simply to store each query and result, and look that up before doing more serious work. A more problem-specific approach – probably what your teacher is after – is to compute distinct … Read more

[Solved] Can someone explain this line of c++? [closed]

Looks like my previous answer was a bit terse… cout << results[rand()%(sizeof(results)/sizeof(results[0]))] << endl; could be broken down to int num_elems = sizeof(results)/sizeof(results[0]); int randomIndex = rand() % num_elems; int randomValue = results[randomIndex]; cout << randomValue << endl; In slightly more detail: sizeof(results)/sizeof(results[0]) calculates the number of elements in the array results. (Note that this … Read more

[Solved] What kind of task will be done with the following code?

The program builds a new number reversing the order of decimal digits of the entered number. For example if 123 was entered then the result will be 321. By the way why do not to compile it and see the result?:) 0 solved What kind of task will be done with the following code?

[Solved] Error: You’ve provided an invalid postage policy while adding FixedPrice Listing [closed]

There are basically three possible reasons for this error. I can’t tell which one applies because you didn’t really post any details in the question. One, your secret code has a subtle bug that wasn’t tripped with previous listings. Resolution: Debug your code. Two, eBay made a change to their postage policy or listing validation … Read more

[Solved] How To Access Two Databases in a Single connection String in C#?

You use two separate connection objects: SqlConnection con1 = new SqlConnection(@”Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\sms.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True”); SqlConnection con2 = new SqlConnection(@”Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\sms2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True”); solved How To Access Two Databases in a Single connection String in C#?