learn data structures with myassignmenthelp.net

17
www.myassignmenthelp.ne t Data Structures

Upload: myassignmenthelpp

Post on 30-Dec-2015

65 views

Category:

Documents


0 download

DESCRIPTION

Data Structures is an Integrated and most Important part of the programming. Every Programmer should have a knowledge of data structure in order to be a successfull programmer. So for the convenience of the programming aspirants www.myassignmenthelp.net offers an Online Tutoring and Online Assignment Help where Anyone who wants to learn data structures or wants to get their problem solved can send their request and myassignmenthelp.net will provide the solutions before the deadline given. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Data Structures

Page 2: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Introduction

• Data Structure is a way to store and organize data in the structured manner. Computer's memory is divided into small parts, we use different data structures to store data in those small blocks. Example: Arrays, Linked list, Trees etc

• A means of storing a collection of data.

Page 3: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

algorithm

• A systematic method of instructing an agent how to accomplish a task.

• Usually expressed in a step-wise sequential form.

• May involve alternation, iteration or recursion

• Detail and language may depend on the agent

Page 4: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Data structure and algorithm

Algorithms are part of what constitutes a data structures. In constructing a solution to a problem, a data structure must be chosen that allows the data to be operated upon easily in the manner required by the algorithm. In conclusion

Data Structures + Algorithm = Program

Page 5: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Application of data structure

Stack Application

– Direct Application

• Page-visited history in a Web Browser

• Undo sequence in a text editor

• Chain of method calls in the Java Virtual Machine or C++ runtime environment.

– Indirect Application

• Auxiliary data structure for algorithm

• component of other data structure

Page 6: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Application of data structure

Queue Applications

– Direct Application

• Waiting lines

• Access to shared resources (e.g printer)

• Multiprogramming

– Indirect Application

• Auxiliary data structure for algorithms

• Component of other data structure

Page 7: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Classification of data structure

• Linear

– In Linear Data Structure, the data items are arranged in linear sequence. e.g. Array, Stack, Queue, Linked List.

• Non-Linear

– In Non-Linear Data items are not in sequence. e.g. Tree, Graph, Heap.

Page 8: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Classification of data structure

• Homogeneous

– In Homogenous data structure, all the elements are of same type e.g. Array

• Non-Homogenous

– In Non-Homogenous data structure, the elements may or may not be of same type e.g. Record.

Page 9: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Arrays

• Array is basic data structure in which we store data in continues memory locations.

• Array is variable which holds multiple elements of same type

• Arrays reduce the redundancy

• Generic form of arrays:

– data type array_name[size];

– Data type: what type of data(int, float, char...)

– Size: number elements you want to store

• Disadvantages:

– Capable of holding only one type of elements.

– Insertion and deletion is very difficult

– Waste of memory is very high

Page 10: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Linked list

• Linked List

– Collection of nodes which or connected together

• Node

– Is just like variable but it holds data and address of the next node or null

• When linked list is useful:

– Do not know the number of data elements

– Your list need to be sorted quickly

Page 11: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Linked list

• Advantages:

– Memory efficiency is very high

– Insertion and deletion is very easy and fast

• Disadvantages:

– Traversal is very slow

– If you want to access 10th element in the list you need to cross 9 elements (arrays are very fast because of index)

– You can move only in one direction in single linked list

– If one link is corrupted remain data will be lost

Page 12: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Double Linked list

• In single linked we can move only in one direction

• Double linked list allow us to move in direction.

• Double linked is also collection of nodes, but here node is contains more than 2 fields.

• Node: one field holds data, second field holds address of next node or null and third field holds address of previous node or null.

Page 13: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Double Linked list

• Disadvantages:

– Need extra space for holding references

– Still it is very slow to travel across the list

• Circular linked list:

– If the head of linked list is connected to tail that listis called circular linked list.

• Application of linked list:

– Stacks and Queues.

Page 14: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Stack

• Stack: – New nodes can be added and removed only at the top

– Similar to a pile of dishes

– Last-in, first-out (LIFO)

– Bottom of stack indicated by a link member to NULL

– Constrained version of a linked list

Page 15: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Operations on Stack: Push

Adds a new node to the top of the stack

Pop

Removes a node from the top

Stores the popped value

Returns true if pop was successful

Page 16: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Queue

• Queue:

– Similar to a supermarket checkout line

– First-in, first-out (FIFO)

– Nodes are removed only from the head

– Nodes are inserted only at the tail

• Insert and remove operations:

• Enqueue (insert) and dequeue (remove)

Page 17: Learn Data Structures With Myassignmenthelp.Net

www.myassignmenthelp.net

Thank You