|
...when I travel and meet foreign people, it happens to ask - sometimes - stupid things. They, kindly say:
- That's a good question...
I think that you posted a good question...;P
|
|
|
|
|
Divide 30 by half and add 10, so what will you get?
|
|
|
|
|
Integer or floating point arithmetic?
|
|
|
|
|
|
how old are you ?
|
|
|
|
|
Muliply 30 with half and subtract 5.
------------------------------
PROST Roleplaying Game
War doesn't determine who's right. War determines who's left.
"Would you like us to drop a bomb on you too? We have 10,000 of them!"
- espeir
"Perhaps we should lend them a nuke or two."
- espeir
|
|
|
|
|
maybe lying on his birthdate... i don't think 1984 seems correct... lol
|
|
|
|
|
toxcct wrote: maybe lying on his birthdate... i don't think 1984 seems correct... lol
Or someone was using the account of his big brother
------------------------------
PROST Roleplaying Game
War doesn't determine who's right. War determines who's left.
"Would you like us to drop a bomb on you too? We have 10,000 of them!"
- espeir
"Perhaps we should lend them a nuke or two."
- espeir
|
|
|
|
|
What are the ways to find a cube of a number other than
1. X~3 = X * X * X
note : ~ = to the power
|
|
|
|
|
X2*X
"I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon
Web - Blog - RSS - Math - LinkedIn
|
|
|
|
|
X^3 = (2X)^2 + (X^2)*(X-4)
^ power
* multiply
|
|
|
|
|
|
If X doesnt work then, you can make use of Y
Y~3 = Y * Y * Y
note : ~ = to the power
|
|
|
|
|
noname71 wrote: X~3 = X * X * X
Y = X³ = X * X * X
Are you looking for X?
Then you should take the third root out of Y.
Are You looking for the power (3 in this case) with X^n?
Y = X^n
log(Y) = n * log(X)
n = log(Y) / log(X)
If you are looking for Y just multiply
Regards,
Ingo
------------------------------
PROST Roleplaying Game
War doesn't determine who's right. War determines who's left.
"Would you like us to drop a bomb on you too? We have 10,000 of them!"
- espeir
"Perhaps we should lend them a nuke or two."
- espeir
|
|
|
|
|
|
Don't post homework problems here
Do it yourself!
That's no moon, it's a space station. - Obi-wan Kenobi
|
|
|
|
|
thanks for your help and just to let you know i have tried to do it myself and the idea of this site is to ask for help.we are not all as clever as others when it comes to c++.
thanks for your advice
klck2000
|
|
|
|
|
klck2000 wrote: we are not all as clever as others when it comes to c++.
Nobody is gonna write a whole program for you. Most people tend to rather you put some effort into solving the problem yourself, rather than just post your homework question so other people can do your dirty work while you don't learn the material.
None of the uber programmers started off as such you know. It takes effort.
BTW, if you don't understand something, why can't you ask your teacher for clairty? I mean, that's what they are there for right?
Jeremy Falcon
|
|
|
|
|
Calculating the mean and median are a fairly easy task. Standard Deviation is a little harder.
What do you need help with, exactly what don’t you understand how to do?
Before you answer that, write out some pseudo code and go through the logic.
Post a specific question that proves you have attempted this on your own, otherwise I don’t think you will get much help.
If you need links to information for standard deviation you can find more then enough information using google. However, I will start you off.
http://www.med.umkc.edu/tlwbiostats/variability.html#deviation[^]
Good luck and enjoy the challenge.
will
I hate users. Not all of them, just the ones who talk.CP member: Al Einstien
|
|
|
|
|
Given two arrays, containing equal number of elements but not in the same order of appearance, what is the fastest method of checking whether the elements in the arrays match or not?
Note - This should be accomplished without sorting the arrays.
Cutebug
|
|
|
|
|
There are only two efficient ways do compare such datastructures: building two efficient ones (like trees or hash table) or by sorting them. Why don't sort, it would be the fasted? Is it for school, I can't imagine another problem with such "curious" restrictions???
Perhaps you should go a little bit into detail, perhaps we can find another solution then.
Regards,
Ingo
------------------------------
PROST Roleplaying Game
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
I'd do the following:
another array of the same size as the first two. used to store flags (say: all values initialized as 'o' and they are to be set to 'x')
if array1.size != array2.size
abort with message "not identical"
arraysize = array1.size
For i = 0 to arraysize
iterate over array1 with i
For j = 0 to arraysize
iterate over array2 with j
if array1[i] == array2[j] && array3[j] != 'x'
array3[j] = 'x'
else if j == arraysize - 1 abort with message "not identical"
else continue
message "identical"
(i wrote this down from memory. if this doesnt work, my memory failed me.)
Basically, you need to examine each element of the first array and see if there is a match in the second array. If there is a match, you need to exclude that element from further comparison (so you can have multiple identical objects in one array and you dont match one object against 2 others). The check is over once you reach the end of the second array without finding a match for an element of the first array.
Since the arrays are unsorted, you need additional space for each element of array2 to remember if it was already used for a match. Also, in the worst case, you have to make (n² + n) comparisons and n assignments to compare both arrays.
if you had 2 containers with sorted contents, you would not have to make any assignments and only n comparisons in the worst case.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
hash each element, count the hashes, if number of hashes is 2 for every number of hashed entries, you have identicle arrays, this trades memory for time. You said fastest, but made no requirements for memory, so use a good and fast hash like superfast hash. you can always terminate the hash count if you ever find a 1 count unless you need to know how many differing items occur. allocate your hash at 2.5 times n (n-length array), which gives you the worst case possibility that there are no matches between the two arrays.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
The only problem with this approach is if 2 elements from array 1 have the same hash, and 2 elements from array 2 have the same hash (but the elements from array 1 do not match those of array 2 -- that is, they have differing hashes), you will end up with 2 hashes that each match 2 elements, but those elements wouldn't have a match in the corresponding array.
That problem goes away if the elements in each array are guaranteed to be unique.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
The problem also goes away if you add in separate bytes, high byte, low byte, this differentiates and still limits the search. However, uniqueness is still a matter of length of items and hashing algorithm and room for hash. Generally you expand your hash table to provide for uniqueness.
He was asking the fastest method, brute force searches guarentee correct results but are always the slowest operation. Thus, hashing provides a fast interface to a 3n access, hash+hash+test, where as a brute force search is done in powers, especially with unsorted. Sorted arrays generates sorting over-head, plus comparision overhead, reducing the speed. hash is a way to access sorted speed without a sort.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|