After a general grasp of the syntax in C++ you need to learn how to choose between algorithms for a problem. There is a benefit to efficient algorithms. The benefit being computing time. One way can take a few miliseconds and another way can take YEARS!
'X to the power of 10'(X^10' might be greater then '10 to the power of X'(10^X) when X is 2. But at a certain point 10^X surpasses X^10. X=10 is that point.
To guage the overall efficiency of an algorithm you use 'Big O'. No not that cartoon on Adult Swin on Cartoon Network. O <-- thats what it looks like.
Lets look at an example to get a general idea of how to use all this.
...
for(int i = 0; i<2; i++)
{
for(int j = 0; j<2; i++)
{
cout << i << " " << j << endl;
}
}
...
/*OUTPUT:
...
0 0
0 1
0 2
1 0
1 1
1 2
2 0
2 1
2 2
...
*/
This is a nested 'for loop'. A 'for loop' inside a 'for loop'. Lets say one loop is X. If you have 2 loops right after each other then its just X + X. If they are nested then it's X * X. So for the above example the Big O would be O(X^2).
Not very efficient but it's a start.
This is not the best guide to data structures. It is just a VERY BASIC guide to get people interested in programming. I've been up for 34 hours straight so my thinkings really poor. I want some feed back.
'X to the power of 10'(X^10' might be greater then '10 to the power of X'(10^X) when X is 2. But at a certain point 10^X surpasses X^10. X=10 is that point.
To guage the overall efficiency of an algorithm you use 'Big O'. No not that cartoon on Adult Swin on Cartoon Network. O <-- thats what it looks like.
Lets look at an example to get a general idea of how to use all this.
...
for(int i = 0; i<2; i++)
{
for(int j = 0; j<2; i++)
{
cout << i << " " << j << endl;
}
}
...
/*OUTPUT:
...
0 0
0 1
0 2
1 0
1 1
1 2
2 0
2 1
2 2
...
*/
This is a nested 'for loop'. A 'for loop' inside a 'for loop'. Lets say one loop is X. If you have 2 loops right after each other then its just X + X. If they are nested then it's X * X. So for the above example the Big O would be O(X^2).
Not very efficient but it's a start.
This is not the best guide to data structures. It is just a VERY BASIC guide to get people interested in programming. I've been up for 34 hours straight so my thinkings really poor. I want some feed back.