### Statistics

### Views

- Total Views
- 387
- Views on SlideShare
- 387
- Embed Views

### Actions

- Likes
- 0
- Downloads
- 11
- Comments
- 0

No embeds

- Total Views
- 387
- Views on SlideShare
- 387
- Embed Views

- Likes
- 0
- Downloads
- 11
- Comments
- 0

No embeds

- Description: A brief introduction to Data Structure and AlgorithmsDuration: 90 minutesStarts at: Saturday 4th May 2013, 07:00PM-by Dharmendra Prasad1
- Table of Contents1. What is a Data Structure2. Need of a Data Structure3. Basic Features of a Data Structure4. Some Basic Examples (Arrays, Linked Lists, Trees, Graphs,Stack, Queues)5. Design Considerations6. Adapting data structures to solve real world problems.7. A brief Introduction to Algorithms2
- What is a data structure?A data structure is a blue print which defines how a data set can beorganized.It can be as simple as a data structure which stores the co-ordinates of a point on a co-ordinate plane or an array ofnumbers/objects.It can also be as complex as a Red-Black Tree or a connected cyclicgraph used by LinkedIn to store user profiles and theirconnections.3
- Why do we need a data structure?Everything has a purpose and so do data structures.Think of a very simple problem of finding sum of 10 numbers. This can be solved byseveral ways as below:1. Input one number at a time and keep it adding to the sum and return the sum.2. Input an array of 10 numbers, iterate through the array, keep adding into sum andreturn the sum.3. Input 10 numbers in a linked list, iterate through the list, add it to the sum and returnthe sum.There might be many more ways, what the point is it is more practical when we can use adata structure to solve this problem statement.4
- Basic Features of a Data Structure.Problem Statement: Sort a list of 100000 numbers in ascending order.Put them in an array, iterate through the array, compare the adjacentnumbers and swap if required. Repeat this process multiple times on thearray till there is no more swaps performed : Bubble SortQuestions:What if accessing the numbers in the array is not as easy as indexedaccess.What if re-arranging the numbers in the array is a tedious task which takesa lot of time.What if putting all the elements in the array is a complex task.Cont…5
- This outlines the features of a good data structure:1. It should be easy to build.2. It should facilitate easy inserts, fetch, update and delete.3. It must not consume more than required memory.4. It should be easily extensible.5. It should support generic data types.6. And of course easy to code and understand.6
- Examples of some data structures:There are multiple data structures mentioned below: Arrays Maps Linked Lists Stack Queues Trees GraphsNote: They all have their purposes, we cant just use onedata structure in place of the other.7
- Design Considerations:As we know data structures are designed for specific purpose.Hence it is important to understand the design consideration.Problem Statement: Storing values against keys and accessing it on afrequent basis and updating it.It is important to find out why we need a data structure for a specific problem.For the above problem:1. Storing values against some identifier.2. Easy access, if possible in access in smallest time.3. Easy updates on the value for a given key.4. Insert need not be very efficient, as our goal is to load it once at the initialsetup.5. Removal need not be very efficient as our purpose is to store, fetch andupate.8
- Brief Introduction to Algorithms.Solving a problem must have a well defined set of steps. These steps in theirspecific order is called an algorithm for the given problem.Problem Statement: Find the largest prime number less than 100.Simplest approach:Create an array of prime numbers and store 2.Run a loop from 2 to 100.for each x between 2 to 100for each number in the prime arraycheck if it divides the x.if x is not divisible by any prime number in the arraystore x as the next prime number.9
- Question&Answers10

Full NameComment goes here.