1 / 19

Introduction to Data Structures Fall 2008

Introduction to Data Structures Fall 2008. Dr. David A. Gaitros dgaitros@admin.fsu.edu. Introduction.

Download Presentation

Introduction to Data Structures Fall 2008

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Data StructuresFall 2008 Dr. David A. Gaitros dgaitros@admin.fsu.edu

  2. Introduction Data structures form the basis for efficient programming methods and data manipulation for today’s computer scientists. They (data structures) are based upon mathematical concepts such as queues, trees, vectors, hash tables, sets etc. “Tree structures represented explicitly in computer memory were described for the first time in applications to algebraic formula manipulation by Grace M. Hopper circa 1951” The Art of Computer Programming, Fundamental Aglorithms, Vol 1, Donald Knuth, Addison Wesley 1969

  3. Data Structures • Vectors (Arrays) • Stacks • Queues • Deques • Single Linked Lists • Double Linked Lists • Circular Linked Lists • Binary Trees • Balanced Binary Trees • Other Tree structures

  4. Vectors

  5. Vectors • Usually simple arrays • All items stored are of the same type as in most data structurs. • Simplest type of data structure • Random access to any item • Insertions and deletions cause us to move on average half the data at any given time.

  6. Stacks ) Stack Pointer Push A + (B/C)

  7. Stacks • FIFO ( First in First out) • Think of any time where you stack one item on top of another. • Two basic operations • Push ( put something on top of the stack) • Pop ( take something off of the stack and use it. Once it is popped, it is no longer on the stack. ) • We range of use in computers and mathematics. • The stack pointer tells us the top of the stack.

  8. Queues Tail Head

  9. Queues • FIFO ( First in First out) • Think of a line at a fast food restaurant. The first person in line is the first to get served. • Always has a pointer to the head and tail. • New items are added to the tail. • When an item is used, it is taken from the head. • Two primary operations • enqueue: Add an item to the queue • dequeue: Remove an item from the queue

  10. Deques Car Y Car X Car W Car Z

  11. Deque (pronounce deck) • The classic definition of a Deque is a double ended queue • Insertions and deletions can be done at both ends of the structure. • Think of how you can add and take away railroad cars at both the front and end of the train.

  12. Linked List A linked list is usually the data structure used to implement an ordered list, queue, stack, deque, tree, etc. The definition if a collection of data items forming a record (or node) linked together by pointers that can specify the location of a specific record.

  13. struct example struct Student_Record { string Last_Name; string First_Name; string FSUSN; int age; int height_CM; int weight_Kilograms: struct Student_Record * Next; }; // As seen, the link Next can point to // another structure of the same type.

  14. Single Linked List Head Node Data Node Data Node Data Node Data Node Data Node Data Node Data Node Data Next Next Next Next Next Next Next Next Tail

  15. Double Linked List Head Prev Prev Node Data Node Data Node Data Node Data Node Data Node Data Node Data Node Data Next Next Next Next Next Next Next Next Prev Prev Prev Prev Prev Prev Tail

  16. Circular Linked List Head Node Data Node Data Node Data Node Data Node Data Node Data Node Data Node Data Next Next Next Next Next Next Next Next

  17. Binary Tree Root Left Node Data Node Data Node Data Node Data Node Data Next Next Right Next Next Prev Prev Prev Prev

  18. Balanced Binary Tree A balanced binary tree tries to have as many nodes on the right as there are on the left. Makes searches behave more predictably.

  19. Other Tree Structure • Directed graphs • Multi-node trees • Unordered Trees • Free Trees (no definite structure)

More Related