In this pandemic, I got in touch with many undergraduates and I found a common pattern. They all seem to be confused, usually spread all over the place. On top of that, they are running after the wrong stuff.
You see today the internet is filled with information. If you want to learn something, it is just a search away. And this is a good thing.
But it can easily overwhelm you especially when you are new. Not just that, it might set you off in the wrong direction very fast.
In this article, I will try to address this problem.
I will try to explain to you what I have learned over the course of my career and how can you start your career in the right way. And trust me there is a right way.
Table of Contents
Let’s Define Programming…
Computer Programming is a combination of two things:
- Design of the Algorithm
- Implementation of the Algorithm
It is as simple as that. From now on just remember these two things when it comes to programming – Design and Implementation of an algorithm is programming.
So, what do you understand by Design of the Algorithm?
The design of an algorithm is a sweet combination of all the well-known techniques and new insights (your personal touch). It consists of problem-solving and mathematical thinking.
But I would suggest you give more time in reading and understanding the well-known techniques than your own insights :). At least at the beginning of your career. You will get a lot of time to use your insights.
Once you have started learning about various scientific techniques, you can move to the next step i.e. Implementation of the Algorithm.
Implementation of the Algorithm
The implementation of the algorithm requires good programming skills.
Once you have come up with a good algorithm design, it is very important that you should be able to implement it. And implementation requires good programming skills.
The ability to turn your thoughts into the code is a very valuable skill. And there are companies willing to pay a lot for it. And it is very evident that companies like Facebook and Google pay handsome salaries to entry-level grads as well.
The next thing comes to a programming language. So which programming language should you choose to start your career?
Programming Language To Begin With
Programming language does play a major role especially when you are starting your career.
And I want to make this thing very clear.
Whoever says that programming language is just a tool to accomplish a task is either a veteran or a senior level developer.
But in this article, I want to be blunt about it; whether you like it or not.
If you are serious about coding then pick C++ as your first language. I would have said C but then I don’t want you to struggle a lot at the start. So, C++ is the best choice for language.
Also, if you will talk to any competitive programmer they will recommend you c++ because it’s very fast and you get almost all the basic data structures with the standard library. This is one more reason that I recommend C++ over C.
Java is another option for you but then it is a complete object-oriented language that comes with its own concepts. It’s not a pure object-oriented language but very close to be a one.
And trust me OOPs should be left for later. It comes with its own set of concepts that you don’t really need at the beginning.
Another popular language in the market is Python.
It is a very high-level programming language which is easy to start with but I would not recommend it to you at the beginning. This is mostly because you will miss the basic constructs of a programming language.
One such example is pointers.
Just by understanding the pointers in C and C++, you understand more than 50% stuff about the language construct automatically.
After that, learning any new language becomes a piece of cake.
But when you start your journey with a high-level language like python you tend to miss on these things which can hurt you later in your career. So without any second thoughts go with C++.
Let me give you a little glance and hopefully get you started today.
C++ Programming Language
Let’s start with a typical C++ template code. This is the same template that people use for competitive programming.
#include <bits/stdc++.h>
using namespace std;
int main() {
// solution comes here
}
The #include
line at the top is the g++ compiler feature that allows us to include the entire standard libraries. This is useful in the terms that you don’t have to include libraries like iostream
, algorithms
etc… separately.
The above code can be compiled using the following command:
g++ -std=c++11 -O2 -Wall test.cpp -o test
The above command produces a binary file from the source code test.cpp
. The compiler follows the C++11 standard (-std=c++11
), optimizes the code (-O2
) and shows warnings about possible errors (-Wall
).
C++ Input and Output
In most of the cases, you will be using standard streams for reading input and writing output.
In C++, cin
is the standard input stream used for reading the input and cout
is the standard output. In addition, the C functions scanf
and printf
can also be used.
The input of the program usually consists of numbers and strings separated by space or newline. Check the below example:
#include<bits/stdc++.h>
using namespace std;
int main() {
int a, b;
string x;
cin >> a >> b >> x;
return 0;
}
This kind of code always works assuming that there is a space or new line between the inputs.
For example – the above code can read both of the below inputs:
123 456 test_input
123 456
test_input
The cout
stream is used for output as follows:
#include<bits/stdc++.h>
using namespace std;
int main() {
int a = 123, b = 456;
string x = "monkey";
cout << a << " " << b << " " << x << "\n";
return 0;
}
A small tip for competitive programmers: Input and output can be bottleneck sometimes. So, you can put the following lines of code at the beginning of the code to make input and output more efficient.
ios::sync_with_stdio(0);
cin.tie(0);
I will leave the article here. And if you have enjoyed reading it then do subscribe. I’ll be writing articles on algorithms and data structures for the next few days. It will be a great piece for you all to learn.
Let me know if you have any questions or concerns in the comments below. I will reply as quickly as I can.
Following articles may interest you:
- Long Polling Implementation with Spring Boot and Java
- Undirected Graphs [Examples, Implementation & Graph Processor]
- QuickSort – Understanding the QuickSort Algorithm and Implementation
- Create Page Layouts with React and Typescript
- Time Complexity Comparison Sheet Of Elementary Sorting Algorithms
See you next time.