{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

set12 - Data Structures 1 Classification of data structures...

Info icon This preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Data Structures Data Structures
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last modified: Jan. 2001 1998 Dr. M. Moussavi 2 Classification of data structures: Classification of data structures: Linear data structures Queues (FIFO) Stacks (LIFO) Linked lists singly linked list doubly linked list multiple list
Image of page 2
Last modified: Jan. 2001 1998 Dr. M. Moussavi 3 Classification of Data Structures Classification of Data Structures (Continued) (Continued) Hierarchical structures trees Graph structures Set structures3 Hashing
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last modified: Jan. 2001 1998 Dr. M. Moussavi 4 Stack a Last in First out structure Stack a Last in First out structure Implementing a stack in an array: Data push 43 push 23 push 53 pop pop push 100
Image of page 4
Last modified: Jan. 2001 1998 Dr. M. Moussavi 5 Stack a Last in First out structure Stack a Last in First out structure (Continued) (Continued) 1 0 4 2 3 1 0 4 2 3 43 1 0 4 2 3 23 43 -1 Stack-Head 0 Stack-Head 1 Stack-Head Push 23 Push 43 Start
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last modified: Jan. 2001 1998 Dr. M. Moussavi 6 Stack a Last in First out structure Stack a Last in First out structure (Continued) (Continued) 1 0 4 2 3 23 43 53 2 Stack-Head 1 0 4 2 3 23 43 53 1 0 4 2 3 23 43 53 1 Stack-Head 0 Stack-Head Push 53 Pop Pop 1 0 4 2 3 100 43 53 1 Stack-Head Push 100 Note: There will be an error if trying to push onto a stack which is full, or to pop from a stack which is empty (stack-Head == -1).
Image of page 6
Last modified: Jan. 2001 1998 Dr. M. Moussavi 7 Queues (FIFO) Queues (FIFO) Queues are an abstraction of such natural occurrences as ticket lines and store checkouts. Used in operating systems and multi programming I/O’s. Enter at the end of the line, pass through the line one position at a time, and leave from the head of the line. Deletions are made from the head of the queue.
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last modified: Jan. 2001 1998 Dr. M. Moussavi 8 Queues (FIFO) Queues (FIFO) Additions are made to the tail of the queue. Queues can be implemented with an array and two pointers (a Head pointer, and tail pointer). The head pointer points to the entry, which will be removed from the queue. The tail pointer points to the location where the next entry will be stored.
Image of page 8
Last modified: Jan. 2001 1998 Dr. M. Moussavi 9 OFFSET DATA 0 1 2 3 Head Pointer -1 Tail Pointer 0 OFFSET DATA 0 1 2 3 A Head Pointer 0 Tail Pointer 1 Add A to the Queue: OFFSET DATA 0 1 2 3 A B Head Pointer 0 Tail Pointer 2 Add B to the Queue: OFFSET DATA 0 1 2 3 A B C Head Pointer 0 Tail Pointer 3 Add C to the Queue: Queues (FIFO) Queues (FIFO) Queue is empty:
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last modified: Jan. 2001 1998 Dr. M. Moussavi 10 OFFSET DATA 0 1 2 3 A B C Head Pointer 1 Tail Pointer 3 Delete from the Queue: Queues (FIFO) Queues (FIFO)
Image of page 10
Last modified: Jan. 2001 1998 Dr. M. Moussavi 11 Circular Queues (FIFO) Circular Queues (FIFO)
Image of page 11

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern