in essence, an algorithm is a step by step procedure to solve a problem

Being comfortable with algorithm one can solve a problem in 1 hour, while the other who is not familiar with algorithms might take several day’s to figure out the solution.

for instance, if you are not familiar enough with algorithms, you won’t even know there exist an elegant solution out there.

in fact, according to John Sonmez the author of the book “the complete software developer’s career guide”.

to point out, he says that every software developer must be familiar with arrays, trees, linked list, stack, queues.

John Sonmez also says that he realized the importance of data structure and algorithms when he was competing on the website called Top Coder

knowing data structure and algorithms gave him a competitive edge over other developers, who were also competing on the same website

to sum up, being good with data structure and algorithms gives the competitive edge to one developer over other.

#### Example of an algorithm

suppose you want to eat an apple, so what steps you will take to eat an apple

**Step1: **take an apple

**Step2: **wash with water

**Step 3: **cut the apple with a knife into four piece’s

**Step4: **eat each piece one by one till you
finish it

So, here are the four steps that you need to eat an apple. These four steps are nothing but the algorithm to eat an apple

#### An analogy

You can think algorithm as a recipe, same as recipes we need in order to make a certain food. Like how much amount of salt needed, at what boiling point you have to mix the rice in the water when to add oil, so in a way algorithms are recipes to solve a problem

#### Algorithm meaning

in short, an algorithm is a procedure, which takes some input values and produces some output values

Example: given input sequences of number (15, 24, 77, 68, 25) then a sorting algorithm(reordering) gives an output(15, 24, 25, 68,77)

to be sure, see some algorithm example in C programming language with pseudo-code

#### What is Data Structure

in a word, the data structure is a logical way of storing and organizing data.

Data structures and algorithms go together with each other

If you have ever read any algorithm book you might notice, they cover data structure first because it is the core of the algorithms

in reality, it is impossible to implement merge sort algorithm if you don’t know data structures( arrays, linked list, queues)

#### Basic concept

**Data: **are simply value’s which are represented by 0’s and 1’s

**A data item: **now** **a data item is a single element of a data

**Group item: **the data item which is divided into subitems are known as a group item.

For example: a student’s name can be divided into 3 subitems

: first name

: middle name and

: the last name

#### Data Organization

Attributes | Values |

employe’s name | John |

sex | M |

age | 29 |

Id. Number | 185-66-774 |

that is to say, values of an employee’s data are assigned to the attributes

**Still confused! **Let
me explain you with the simple concept using apples

Suppose you have 100 apple’s then will you create 100 different boxes to keep this apple’s or keep all the apple’s in a one-box called array (Data structure)

**But wait!**

** **what is an Array?

in sum, an array is a data structure that we use for storing the collection of similar data elements.

Let me explain you another example so that you will have a clear idea of data structure’s

Suppose if you have 100 students then will you create a 100 class(variables) for it,

**No! **

We don’t do that because it is complicated and complex

so, to reduce the complexity we use only class(variable) called student

the main purpose of using data structure is to reduce the complexity

we use data structures in our programming instead of creating 100 different variables because we can create only one variable called Array in comparison, with 100 different variables

#### What kind of problems algorithms solve?

in general, determining all the 100,000 genes in DNA of human

in another case, storing information in the database require sophisticated algorithms

the internet we use and also over the world people can access information with the help of algorithms

finding the good routes during traveling.

#### Some data structures are

- Arrays or vectors
- Stacks
- Linked lists
- Queues
- Trees
- Hashes
- Sets

#### Data structure operations

basically, the data structures are chosen based on a particular operation is performed number of times

- Traversing
- Inserting
- Searching
- Deleting
- Sorting
- Merging
- Copying and concatenation.

generally, organizing, structuring data is important to the design, development of efficient algorithms and program implementation

#### Which algorithm In computer programming is best?

We have a large number of algorithms In computer science at our disposal then how to choose? it depends on the factors such as the number of items to be sorted, the computer architecture and what kind of storage devices you used.

## Leave a Reply