Data structure


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Data structure

  1. 1. Junaid khan Visiting Lecturer University of Peshawar
  3. 3. It is a logical way of storing data and it also define mechanism of retrieve data.
  4. 4. What are Data Structures?   Data may be organized in many different ways. A Data Structure is an arrangement of data in a computer’s memory or on a disk.  The logical or mathematical model of a particular organization of a data is called Data Structures.  The choice of a data model depends on two consideration: 1) It must be rich enough in structure to mirror the actual relationships of the data in the real world. 2) The structure should be simple enough that one can effectively process the data when necessary.
  5. 5. Types of Data Structure DATA STRUCTURE LINEAR NON LINEAR
  6. 6. The data appearing in data structures are processed by means of operations. The following are operations are major operations: a) Traversing: Accessing each record exactly once so that certain items in the record may be processed. b) Searching: Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions. c) Inserting: Adding a new record to the structure. d) Deleting: Removing a record from the structure. Following two are special operations: a) Sorting: Arranging the records in some logical order. b) Merging: Combining the records in two different sorted files into a single sorted file.
  7. 7. An algorithm is a well-defined list of steps for solving a particular problem. Algorithms manipulate the data present in data structures in various ways, such as searching for a particular data item and sorting the data. Flowcharts are pictorial representations of the algorithms. Properties/ characteristics of the algorithm: a) Finiteness: Total number of steps used in an algorithm should be finite. b) Definiteness: Each step of algorithm must be clear and unambiguous. c) Effectiveness: Every step must be basic and essential. d) Input/output: The algorithm must accept zero or more input and must produce at least on output.
  8. 8. 1.Array 2.Stack 3.Queue 4.Linked List
  9. 9. An array is a collection of homogeneous type of data elements. An array is consisting of a collection of elements .
  10. 10. 1.Traversing 2.Search 3.Insertion 4.Deletion 5.Sorting 6.Merging
  11. 11. Representation of array in memory 1 2 3 4 5
  12. 12. Array Representation
  13. 13. A Stack is a list of elements in which an element may be inserted or deleted at one end which is known as TOP of the stack.
  14. 14. Push: add an element in stack Pop: remove an element in stack
  15. 15. Representation of Stack EEE DDD CCC BBB AAA TOP
  16. 16. Stack Representation
  17. 17. A queue is a linear list of element in which insertion can be done at one end which is known as front and deletion can be done which is known as rear.
  18. 18. Insertion : add a new element in queue Deletion: Removing an element in queue
  19. 19. Representation of Queue 55 65 75
  20. 20. Queue Representation
  21. 21. A Linked list is a linear collection of data elements .It has two part one is info and other is link part gives information and link part is address of next node
  22. 22. 1.Traversing 2.Searching 3.Insertion 4.Deletion
  23. 23. Linked Representation
  24. 24. 1.Tree 2.Graph
  25. 25. In computer science, a tree is a widely-used data structure that emulates a hierarchical tree structure with a set of linked nodes.
  26. 26. 1.Insertion 2.Deletion 3.Searching
  27. 27. Tree Representation
  28. 28. A graph data structure may also associate to each edge some edge value, such as a symbolic label or a numeric attribute (cost, capacity, length, etc.).
  29. 29. 1.Searching 2.Insertion 3.Deletion
  30. 30. Graph Representation