FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Simple Question





NewGuyinTown
How do we solve for n:

n / log_2(n) < c : c is a constant
[Original Equation: n^2 < c n log_2( n ) ]
(Sorting algorithms using the iterative method.)

Ughh... It feels like I had done these kinds of algebraic problems 5+ years ago... can't remember.

Thank you.
qscomputing
Solve for n/log2(n)=c first.

If you're using an iterative method, then you first find an equation with n on its own on the left and n with other stuff on the right. This is fairly easy:

n = c * log2(n)

Then you'll want to convert that log2(n) into something you can resolve easily on a calculator; if memory serves then it is this:

n = c * ln(n) / ln(2)

where ln is the natural logarithm, ie base e. You could use log10 instead if you wanted.

Then you choose an arbitrary value of n which is reasonably close to what you expect, and call that n0 - lets say n0 =2.

Then you do this:

n1 = c * ln(n0) / ln(2)
n2 = c * ln(n1) / ln(2)
n3 = c * ln(n2) / ln(3)
until you have the value accurate to the level of precision you want.

Say that n5 is accurate enough for you, you can then say that n=n5, correct to x sf.

Then you can substitute that value of n back into your original equation, and then find the range where n/log2(n) < c.

Please double-check everything I have said here to make sure that it is mathematically sound before using it. This is provided in the hope that it will be useful, but I disclaim all responsibility for any errors.

That said - HTH.
Related topics
PHP, MySQL...
PHP Mail Function
Anyone play Habbo Hotel or Runescape?
I have a simple question
UPLOAD STILL NOT WORKING?!
A soldier's rant
Will Jesus Return ? WHEN / HOW ...
Simple Question
A quick PHP Question! You know the answer! Answer ASAP .
Which free e-mail service do you prefer?
just asking a simple question for you...
Question
A simple question !!, Will this hosting support Trac ?
Question about webdesign market
A question to atheists
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.