Computing factorials of higher order in JavaScript/C/C++
Following is the JavaScript code for computing factorials of higher order (>1000). Click here for the working code.
It doesn't involve any recursive multiplication. The underlying idea behind this is the kids way of doing multiplication.
JavaScript code
function calculate(){
var n=;//give number here
var a=new Array();
var i;
var j;
a[0]=1; //initializes array with only 1 digit, the digit 1.
var m=1; // initializes digit counter
var temp = 0; //Initializes carry variable to 0.
for(i=1;i<=n;i++)
{
for(j=0;j<m;j++)
{
x = a[j]*i+temp; //x contains the digit by digit product
a[j]=x%10; //Contains the digit to store in position j
temp = parseInt(x/10); //Contains the carry value that will be stored on later indexes
}
while(temp>0) //while loop that will store the carry value on array.
{
a[m]=temp%10;
temp = parseInt(temp/10);
m++; // increments digit counter
}
}
return a;// returns array containing the factorial
}
Here is C/C++ code
#include<stdio.h>
int main()
{
int t;
int a[10000]; //array will have the capacity to store 200 digits.
int n,i,j,temp,m,x;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
a[0]=1; //initializes array with only 1 digit, the digit 1.
m=1; // initializes digit counter
temp = 0; //Initializes carry variable to 0.
for(i=1;i<=n;i++)
{
for(j=0;j<m;j++)
{
x = a[j]*i+temp; //x contains the digit by digit product
a[j]=x%10; //Contains the digit to store in position j
temp = x/10; //Contains the carry value that will be stored on later indexes
}
while(temp>0) //while loop that will store the carry value on array.
{
a[m]=temp%10;
temp = temp/10;
m++; // increments digit counter
}
}
printf("the number of digits %d\n\n",m );
for(i=m-1;i>=0;i--) //printing answer
printf("%d",a[i]);
printf("\n");
}
return 0;
}
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming
Top Algorithms used in Computer Science and Engineering
Algorithm: Algos is a Greek word for pain, Algor in Latin, meant to be cold. Neither is the root for Algorithm, which stems instead from al-Khwarizmi, the name of the ninth-century Arab scholar whose book al-jabr-wa'l muqabalah developed into today's high school algebra textbook. He stressed the importance of methodical procedures for solving problems.
List of Algorithms in Wiki. It's is quite a big list. So, i have to do something else to start learning algorithms.
THE MOST IMPORTANT ALGORITHMS
The criterion for suggestions was that the algorithms should be widely used. Further they have restricted themselves to the fields of Computer Science and Mathematics. List is in alphabetical order. It is quite a big list.
A* search algorithm
Beam Search
Binary Search
Branch and Bound
Buchberger's algorithm
Data compression.
Diffie-Hellman Key exchange
Dijkstra's algorithm
Discrete algorithm
Dynamic programming
Eucledian algorithm
Expectation-maximization algorithm(EM- Training)
Fast Fourier transform(FFT) with Convolution theorem
Gradient descent
Hashing
Heaps(heap sort)
Karasuba multiplication
LLL algorithm
Maximum flow
Merge sort
Newton's method
Q-learning
Quadratic sieve
RANSAC
Schonhage-Strassen algorithm
Simplex algorithm
Solving a system of linear equations
Strukturtensor
Union-find
Viterbi algorithm
The Best of the 20th century: Editors name top 10 algorithms
" We tried to assemble the 10 al-gorithms with the greatest influence on development and practice in Computer Science and Engineering. "
List is in chronological order.
Monte Carlo method
Simplex method for linear programming
Kyrlov subspace iteration methods
Decompositional approach to matrix computations
Fortran optimizing compiler
QR algorithm
Quicksort
FFT(Fast Fourier Transform)
Integer relation Detection algorithm
Fast Multipole algorithm
10 Algorithms every CS student must implement once in their life.(Quora question)
Answer with maximum votes.
1. Classification by implementation:
Recursive or iterative
Logical or Procedural
Serial or Parallel
Deterministic or non-Deterministic
2. Classification by design paradigm:
Divide and conquer
Dynamic programming
The greedy method
Linear programming
Using graphs
The probabilistic and Heuristic paradigmÂ
TOP TEN ALGORITHMS IN DATA MINING
Some of the most influential that have been most widely used in data mining community.
EARLIER TEMPTATION WAS A SLAVE TO DESTINY....TODAY IT ENSLAVES YOU INSTEAD, AND TECHNOLOGY OFFERS SURE ACCESS TO ANYONE YOU ARE TEMPTED TO LINK UP WITH
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming
It is easy to Create a table in mysql by sending a query through php. Setting up the connection variables:
        $mysql_host="host";
         $mysql_dbuser="user";
         $mysql_dbpass="password";
         $mysql_dbname="database";
Connecting to database and checking:
$connect=
mysqli_connect("$mysql_host","$mysql_dbuser","$mysql_dbpass","$mysql_dbname"); if (mysqli_connect_errno()){ die ("Failed to connect to MySQL: " . mysqli_connect_error()); }
Sending Query for creating table:
$create=mysqli_query($connect,"CREATE TABLE tablename ( id INT ,name VARCHAR(15) NOT NULL, email VARCHAR(15), about TEXT)");
This creates a table with columns id, name, email and about with their respective Data types. You can check HEREÂ for various Datatypes offered in MySQL. By default column is set to NULL in mysql, if you want it to be NOT NULL it should be explicitly mentioned. Very often we would like the value of the id to be created automatically every time a new record is inserted.
Creating table with one of the columns as auto autoincrement:
$create=mysqli_query($connect,"CREATE TABLE tablename ( id INT NOT NULL AUTO_INCREMENT,name VARCHAR(15) NOT NULL, email VARCHAR(15), about TEXT),PRIMARY KEY (id)");
You won't be able to create table if you miss PRIMARY KEY (id), id should be declared as PRIMARY KEY if you want it to auto increment. Once i wasted lot of time by missing PRIMARY KEY, that is the very reason i wrote this.
Almost everyone has Facebook and Twitter accounts, and almost all of us have friends and followers that number in the few hundreds, if not thousands. But every now and then you don’t want to post personal thoughts and pictures for all to see. The interweb is now home to a bunch of resources that cater to small and most intimate groups. In in post i tell you how you can be SOCIAL, BUT PRIVATE.
Family and Friends
SquareHub
     SquareHub is a social network that is tailor-made for family amd close friends. To start a 'hub', however, you need to install a mobile app and create a shared login before inviting others to join. Invitees also need to install the app.
Hub members can post photos and updates.
It's photo gallery includes built-in photo effects and stickers, which can be used to edit you snap shots.
SquareHub works well to plan events like picnics ans parties after checking every ones  schedules.
Within a group, you can choose to share updates only between a select few.Â
Available on: Android, iOS | for free
23snaps
      There is a new addition to your family. Just create an account on 23snaps, a free service that lets you share pictures and videos of your li'l champion with grandparents, and the new uncles and aunts.
Posts can include height and weight updates, "first step" photos and even videos of your tiny tot saying his or her first words.
23snaps also filter system that lets you keep certain posts private, and visible to your spouse only.
The Android and iOS app also lets you spruce up your snapshots with built-in filters. Images already uploaded to Picasa, Flicker or Instagram can be imported to your albums.Â
This service can be accessed from the web browser too, so it isn't mandatory to install the app on you molile.
Available on: Android, iOS,Web | for free
Keepy
Keepy is another resource that lets you maintain a feature rich online scrapbook, filled with photographs of your child's doodles and craftwork. And starting an account is as simple as downloading an app, creating login and profile for each of your kids before posting images.
Pictures can be tagged with keywords as well as location data. To add pizzazz to posts, you can embed voice notes and videos too.
The scrapbooks can be shard to relatives and friends by just adding them as fans. It is not compulsory for the fans to install the app. The receive secure links via e-mail and be able to leave comments, voice notes, videos too.
You also get option to share updates on Facebook and Twitter too.Â
A free account lets you add 31 'keepies' per month. Although, inviting friends to use this app increases this limit.
Available on: Android, iOS,Web | for free
School & Work
SGrouples
        SGrouples is a networking website that can be used by professionals as well as students who're seeking a more serious online forum for interaction. The resource uses a tabbed interface to list your news stream, private messages, contacts, and even provides you with 1 GB cloud storage.
Inviting colleagues and classmates is simple. Just connect to your address book in Gmail, Yahoo!, Outtlook, LinkedIn to pick the contacts you wanted to connect through SGrouples. Â
Users can create notes, uplaod documents, tag them and share them with their groups.You can use your cloud storage for photo albums, discussions and 'events calender'.
The service includes a real-time chat box, allowing to message online contacts from the browser or the Android, iOS app.
Since privary on SGroups is important, you can to choose not to have public profile and website promises not to snoop  on your posts, track usage or use your data to make profits.
Available on: Android, iOS,Web | for free
Everyme
      Everyme is a social network that aims to keep things simple amd straightforward. Like Google+, you can create groups like friends, family, colleagues etc.. and even use a separate cover photo for each 'circle'.
The web interface is fairly basic, letting you post text and images to your circles. Notably, an update can only be posted to one group at a time.
In case you want to delete your account, it provides you with an option to export all your posts, including images, videos, comments, etc. to a ZIP file that can be downloaded to a local computer.