Jump to content

cwarn23

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Everything posted by cwarn23

  1. The easiest way to do it is to have a loop which loops through an array of nodes and keep on appending to the array as more nodes are found. Simple concept but probably not the most efficient one.
  2. I just happen to be writing an algorithm which follows similar concepts and the main thing you need to do is record what you have seen as you have gone along. It is actually quite easy when you get your mind around the loop and is only a matter of a decent database structure. For example, this is the database structure I chose: Using that database design you can simply insert newly discovered links into linkdata with backlinks being 1 upon insertion unless the link occurs multiple times in that page. So basically to track the backlinks or the number of depths you simply add the the backlinks variable if another instance of that link has been found along the track in the linkdata table.
  3. Hi, I have just created an algorithm and could this be the greatest algorithm invented for calculating square roots? Perhaps the answer is yes with 100% accuracy unlike some algorithms that round the last digit up. Below is the algorithm I have created and I used php. Also this algorithm can easily be imported into any language with any bitrate and is very scalable unlike some of the standard built in square root algorithms for some interpreters (all of the ones tested so far). Now below is the code with it in both the form of a class and the form of a function. You may notice that the function name is funny but it is tatically named that way so that the string length of the function name is the same as the sqrt() function so you don't get qwerky results when comparing the two. <?php class sqrt { public $value; function __construct($in) { $tmp = (int) $in; $tmpp = ($tmp/2); for ($i=1;($i*$i)<=$tmp;$i*=2) {} $i/=2; for (;($i*$i)<=$tmp;$i++) {} $i--; $k=$i; $i++; if (($i*$i)>$tmp || ($i*$i)<$tmp) { for ($j=1;($i*$i)>=$tmp;$j/=2,$i=($j+$k)) {} $v=strlen((string)$j); $m=1/pow(10,$v); for (;($i*$i)<=$tmp;$j+=$m,$i=($j+$k)) {} $j-=($m); $i=$j+$k; if (($i*$i)>$tmp || ($i*$i)<$tmp) { //$w = (strlen((string)pow(2,32))+1); //$w = same number as below $w = 11; //32 bit $q=$m; for ($n=$v+1;$n<$w;$n++) { $m=1/pow(10,$n); $p=pow(10,(($n-$v)+1)); for ($o=0;$o<$p && ($i*$i)<=$tmp;$j+=$m,$i=($j+$k),$o++) {} $j-=$m; $i=($j+$k); } } } echo $i; $this->value = $i; return $this->value; } } function mysq($in) { $tmp = (int) $in; $tmpp = ($tmp/2); for ($i=1;($i*$i)<=$tmp;$i*=2) {} $i/=2; for (;($i*$i)<=$tmp;$i++) {} $i--; $k=$i; $i++; if (($i*$i)>$tmp || ($i*$i)<$tmp) { for ($j=1;($i*$i)>=$tmp;$j/=2,$i=($j+$k)) {} $v=strlen((string)$j); $m=1/pow(10,$v); for (;($i*$i)<=$tmp;$j+=$m,$i=($j+$k)) {} $j-=($m); $i=$j+$k; if (($i*$i)>$tmp || ($i*$i)<$tmp) { //$w = (strlen((string)pow(2,32))+1); //$w = same number as below $w = 11; //32 bit $q=$m; for ($n=$v+1;$n<$w;$n++) { $m=1/pow(10,$n); $p=pow(10,(($n-$v)+1)); for ($o=0;$o<$p && ($i*$i)<=$tmp;$j+=$m,$i=($j+$k),$o++) {} $j-=$m; $i=($j+$k); } } } return $i; } $s = microtime(true); mysq(128); $e = microtime(true); $a=($e-$s); unset($e,$s); sleep(1); $s = microtime(true); sqrt(128); $e = microtime(true); echo 'mysq time &#160;&#160;='.$a.'<br>'; echo 'mysq result='.mysq(128).'<br>'; echo 'sqrt time&#160;&#160;='.($e-$s).'<br>'; echo 'sqrt result='.sqrt(128).'<br>'; echo 'The mysq function is '.bcdiv(substr(($e-$s),0,11),$a,0).' times faster for this calculation.<br>';
  4. I agree with you there because with a forum like PHPfreaks there are system analysis and technicians but when a single computer noob is trying to host a web forum or a download depo then the chances of that person being able to administrate the entire system without destroying the server is very slim. So that is why experience/knowledge is needed before setting up a vps. And in addition you get better support on shared servers. So my advice, if you don't know how to administrate a vps then don't do it until you know it and if a shared plan suites your requirements then take the shared plan.
  5. Generally if your getting a SVN repository etc then you would purchase a plan that supports such a service. But yes in some cases vps can be better if you have the experience however you will receive very little support from your hosting company about any customizations you make to your vps unlike a shared host where those customizations are pre made.
  6. You must be every salesman's dream. Easy to oversell. I bet you would do just fine with 256 MB. The benefit of a VPS is that you can change how much memory you're allowed to allocate while it's running, so it's just a matter of contacting the sales department asking for an upgrade. Why would you pay for something you don't need? Especially seeing as you've got a £20/mo max. Reaching that will be much easier if you scale down your requirements to something realistic. There is no way you'll need 1 GB (or even 2 GB) memory if you don't even have any traffic yet. Also, "unmetered bandwidth"? That's not going to happen. At least not within your price range. Indeed however I would never recommend 256MB for a vps. Instead I would recommend around 400MB to 512MB of ram. Also some Operating Systems will require more ram than others and so if you think you don't need 400-512MB of ram then shared hosting would be the better option. Also I myself have 750MB ram on my vps and it seems to be pritty good but for something like calculating pi to the last digit or a rainbow/hash table generator that generates 96^6 hashes for reverse lookup then around 1GB would be needed for effective results. Yes I am really wanting an upgrade with my current host but it's been a decade (3 months) since they had vps plans available and am waiting for the new cheaper better plans (Jumba).
  7. Dont forget http://www.jumba.com.au/hosting/personal - They have a wide range of plans for both personal, business and virtual private servers. Also to search for australian hosts by stastics you can use the website at http://www.webhostingchoice.com.au/ Enjoy.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.