Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Data Structures Fall 2008 Dr. David A. Gaitros

Similar presentations


Presentation on theme: "Introduction to Data Structures Fall 2008 Dr. David A. Gaitros"— Presentation transcript:

1 Introduction to Data Structures Fall 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 [0]All [1]good [2]men [3]must [4]come [5]to [6]the [7]aid [8]of [9]their [10]party [11].

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 C + B ( + A A + (B/C) ) Push Stack Pointer

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 Tom Dick Mary Jane Harry Pat Head Tail

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 RR Car 1 RR Car 2 RR Car 3 RR Car 4 RR Car 5 RR Car 6 RR Car 7 RR Car 8 Car X Car Y Car WCar 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 Node DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNext Head Tail

15 Double Linked List Node DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNext Head Tail Prev

16 Circular Linked List Node DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNextNode DataNext Head

17 Binary Tree Node DataRightLeftNode DataNext Prev Node DataNext Prev Node DataNext Prev Node DataNext Prev Root

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)


Download ppt "Introduction to Data Structures Fall 2008 Dr. David A. Gaitros"

Similar presentations


Ads by Google