learn data structures with myassignmenthelp.net

Download Learn Data Structures With Myassignmenthelp.Net

If you can't read please download the document

Upload: steve-johnson

Post on 06-Aug-2015

97 views

Category:

Technology


0 download

TRANSCRIPT

  1. 1. www.myassignmenthelp.net Data StructureS
  2. 2. 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.
  3. 3. 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
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. 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.
  8. 8. 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.
  9. 9. 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
  10. 10. 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
  11. 11. 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
  12. 12. 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.
  13. 13. 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.
  14. 14. 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
  15. 15. 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
  16. 16. 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)
  17. 17. www.myassignmenthelp.net Thank You