Method of learning is just as important as the learning material itself. If you start reading a story backwards, it would probably be more difficult to understand it. But then, as inquisitive human beings, some of us do want to know the climax of the story beforehand and love to trace it backwards.
Pretty similarly, we can learn programming and/or algorithms in either of the two ways - learn all the basic stuff first and then start learning the algorithm and then learn the applications. The other way is to first understand the application, then learn how they work (the algorithm) and for learning the algorithm, learn the basic stuff as well.
On this page, we are going to layout the things we are going to learn and in the order.
Data Structures (often just called as DS) is the study of organizing data in different styles (or structures; hence the term “Data Structures”). We are going to begin our journey with Data Structures. Fact is, throughout our journey, we will have to keep learning more about Data Structures.
Why do we begin with Data Structures?
This is an important question. You might be wondering - If we are going to learn about algorithms, why learn data structures? The reason why we start here is because before we start working on anything, we need to know what we are working with and how it is arranged. For example, if you are asked to search for the number
9 in this list:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Then you would actually take lot lesser time than when the list were:
10, 1, 15, 5, 6, 4, 8, 12, 2, 10, 11, 9, 13, 3, 7, 14
The first list is already sorted, and it takes less time for you to look up the number
9 than when the list is not in sorted order. The way data is already arranged plays a huge role in how we look up for information. When it comes to computers which cannot recognise patters as easily as the human brain, it becomes all the more important to learn to organize data properly so that we could teach the computer to look for the data in the right fashion.
Fact is, all algorithms that you are going to learn are going to expect their input to be in a particular format. For example, if you want to run a Binary Tree Search algorithm, then the data should be provided to the algorithm in the Binary Tree format. If you supply a plain array, the algorithm would either fail to deliver the right result or might just crash and produce no result.
There are multiple ways in which data can be arranged. Some of them are very similar to each other and yet are implemented differently. In this section, we will learn the different types of Data Structures.
Searching is probably the biggest use-case of a computer. You have a million records of financial transactions and want to search the transactions Person P did between dates D1 and D2. What do you want the computer to do? You want it to search for the right info, don’t you? From Google Search to searching a word in a document - searching is everywhere. So we will start off with the simple ones here.
As you might have realised in the example we provided on this page in the Data Structures section, a sorted data set is pretty important. Searching is much easier when the data is properly sorted. So we will learn about sorting
Analysing Performance of different Algorithms
Even with same data structures, same operation takes difference amounts of time with different algorithms. Also, some algorithms are great for small data sets but slow down when the input size increases. For example, if you want to sort 100 numbers, you would hardly notice any difference in performance using either bubble sort or quicksort, especially with computers of today which can perform billions of operations per second. However, if you have 2 million numbers to sort, bubble sort is going to take a lot more time than quicksort. If you were to use a B-Tree as a data structure, sorting would happen in a much different manner than when you want to sort a plain array of 2 million number; also, quicksort and bubble sort are not useful algorithms for B-Tree (though they can be used in part on B-Tree nodes).
We will learn about which data structures match with which algorithms and how different algorithms perform in this section.
By this time we would know enough about both Data Structures and analysis of algorithms that we would look for algorithms dedicated to certain data structures.
List-based Data Structures
We utilise our understanding of Data Strutures and Algorithms to look into searching and sorting again. This is going to be entertaining, refreshing reading after some gray-cell exercise.
We are going to deal with Arrays, Linked Lists, Queues and related structures.
One of the most useful data structures and related algorithms are to be discussed here. In case this sounds boring, remember that Sets-based-algorithms are one of the most important ones for databases. Relational Databases use a lot of set theory.
Tree based Algorithms
Trees are one of the reasons why you can access one record out of a billion in near no time. Ever thought how is it that when you enter your email and password on Facebook and it verifies your credentials in under a second from over a billion accounts? Or open a file from a million from your own hard drive? It’s all becaues of Trees. In this section we will learn about trees.
Graph based Algorithms
Graphs are what help massive relationship structures and one of the core data structures in recommendation engines. When Facebook suggests you a friend or when Amazon suggests you a product you might like, remember they try to establish a relationship of objects in with what/who you already like and follow. For these usecases, graphs are at play. Graphs are also used in networking-based algorithms. In this section we will explore algorithms related to Graphs.
There is a lot more to algorithms which we can talk about. If you want to learn even more about the algorithms, you can follow the Advanced Course to learn more.