The process of program development requires us to, represent the data efficiently and
develop a step by step procedure that performs a given task and can be used to implement
a program. For this we need to study data structures and for this we need to learn about
algorithms. Now data structures are data representation
methods that are used to organize data. So data structures basically provide a way of
organizing data, so that it can be used effectively by the program.
For example the data structures arrays, linked lists, or trees are different ways of representing
the data.
Array is the simplest data structure in which data is organised in linear order in consecutive
memory locations. Linked list is also a linear data structure but it does not store data
in consecutive memory locations. Trees are non-linear data structures which store elements
in hierarchical order.
Learning about different data structures is very important because the choice of proper
data structure can greatly affect the efficiency of our program.
Now lets come to algorithms. An algorithm is a procedure that contains well defined
steps for performing a given task. So basically an algorithm specifies step by step instructions
for solving a problem or performing a particular task.
Now algorithms and Data structures are closely related, When we implement an algorithm we
have to choose a particular representation of data that is have to decide which data
structure to use, and for using data structures we have to develop
efficient algorithms for various operations on these Data structures, like searching,
sorting, traversal etc.
Now we'll learn more about algorithms.
Now given a problem, there can be many ways to solve it, and these solutions are in the
form of different algorithms. So there can be many algorithms to solve a particular problem.
For example there are many different ways in which data can be sorted, so we have various sorting algorithms
Now when we have more than one algorithms to choose from, we would obviously like to
use the most efficient one or the algorithm that is best suited for our requirements.
To decide which algorithm is best for us we should be able to compare the algorithms and
identify the most efficient one.
Now the efficiency of an algorithm mainly depends on these 2 factors. Running time of
the algorithm and Memory occupied by it.
So an efficient algorithm is one that takes less running time and occupies less memory.
There can be other measures of efficiency also, like network usage or disk usage but
these are the two factors which are most important. From these two factors also we are generally
more concerned about the running time of the algorithm.
So in the next lecture, we'll see how we can compare algorithms based on their running
time.