Data Structures: Advanced Damian Gordon. Advanced Data Structure We’ll look at: – Linked Lists – Trees – Stacks – Queues.

Slides:



Advertisements
Similar presentations
Trees Types and Operations
Advertisements

Introduction to C Programming CE Lecture 12 Circular Queue and Priority Queue Data Structures.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Data Structures & Algorithms
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
CS 206 Introduction to Computer Science II 11 / 04 / 2009 Instructor: Michael Eckmann.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
COMP 110 Introduction to Programming Mr. Joshua Stough.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
CS211 Data Structures Sami Rollins Fall 2004.
Summary of lectures (1 to 11)
Chapter 12 Collections. © 2004 Pearson Addison-Wesley. All rights reserved12-2 Collections A collection is an object that helps us organize and manage.
1 Stack Data : a collection of homogeneous elements arranged in a sequence. Only the first element may be accessed Main Operations: Push : insert an element.
© 2004 Pearson Addison-Wesley. All rights reserved12-1 Chapter 12 : Collections Intermediate Java Programming Summer 2007.
Complex Structures Nested Structures Self referential structures A structure may have Data variables Internal structures/unions Pointer links Function.
Chapter 12 Data Structure Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
Damian Gordon.  What is a queue?  It’s a structure that conforms to the principle of First In, First Out (FIFO).  The first item to join the.
October 18, Algorithms and Data Structures Lecture V Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Priority Queue What is that? Implementation with linked list with O(n) behaviour The Heap (O(log(n)) An implementation using an array Your mission …
 2007 Pearson Education, Inc. All rights reserved C Data Structures.
Chapter 8: Data Abstractions Senem Kumova Metin. 8-2 Chapter 8: Data Abstractions 8.1 Basic Data Structures – Arrays – Lists, Stacks, Queues – Trees 8.2.
Introduction to Data Structures Fall 2008 Dr. David A. Gaitros
Data Structures Week 8 Further Data Structures The story so far  Saw some fundamental operations as well as advanced operations on arrays, stacks, and.
1 Chapter 7 Stacks and Queues. 2 Stack ADT Recall that ADT is abstract data type, a set of data and a set of operations that act upon the data. In a stack,
Data Structures (part 2). Stacks An Everyday Example Your boss keeps bringing you important items to deal with and keeps saying: “Put that last ‘rush’
Chapter 8 Data Abstractions. © 2005 Pearson Addison-Wesley. All rights reserved 8-2 Chapter 8: Data Abstractions 8.1 Data Structure Fundamentals 8.2 Implementing.
A data structure is a type of data storage ….similar to an array. There are many data structures in Java (Stacks, Queues, LinkedList, Sets, Maps, HashTables,
Chapter 12: Collections by Lewis and Loftus (Updated by Dan Fleck) Coming up: Collections.
Foundation of Computing Systems Lecture 3 Stacks and Queues.
Cousin of the Stack.  An abstract data type (container class) in which items are entered at one end and removed from the other end  First In First.
Data Structures Types of Data Structure Data Structure Operations Examples Choosing Data Structures Data Structures in Alice.
Dynamic Data Structures Stacks, Queues and Binary Trees hold dynamic data.
3 Data. Software And Data Data Data element – a single, meaningful unit of data. Name Social Security Number Data structure – a set of related data elements.
1 5. Abstract Data Structures & Algorithms 5.1 Data Structure Fundamentals.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
CPSC 252 Binary Heaps Page 1 Binary Heaps A complete binary tree is a binary tree that satisfies the following properties: - every level, except possibly.
CSE205 Review Session SAMUEL & JESSA. Recursion WHAT IS RECURSION?  Recursion is a tool a programmer can use to invoke a function call on itself. 
Queues, Stacks and Heaps. Queue List structure using the FIFO process Nodes are removed form the front and added to the back ABDC FrontBack.
CS223 Advanced Data Structures and Algorithms 1 Priority Queue and Binary Heap Neil Tang 02/09/2010.
Linear Data Structures
Complex Structures Nested Structures Self referential structures A structure may have Data variables Internal structures/unions Pointer links Function.
Data Structures David Kauchak cs302 Spring Data Structures What is a data structure? Way of storing data that facilitates particular operations.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
Python: Stacks and Queues (as a Linked List) Damian Gordon.
B Tree Insertion (ID)‏ Suppose we want to insert 60 into this order 3 B-Tree Starting at the root: 10 < 60 < 88, so we look to the middle child. Since.
CPS120: Introduction to Computer Science Nell Dale John Lewis Abstract Data Types.
Sami Rollins Spring 2006 CS312 Algorithms Sami Rollins Spring 2006.
Data Structure By Amee Trivedi.
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
Chapter 12 – Data Structures
Lecture 7 Queues Stacks Trees.
COSC160: Data Structures: Lists and Queues
12 C Data Structures.
Chapter 15 Lists Objectives
Binary search tree. Removing a node
Introduction to Data Structure
Lesson Objectives Aims
ITEC 2620M Introduction to Data Structures
Queues: Implemented using Arrays
Review & Lab assignments
Stacks: Implemented using Linked Lists
Data structures.
Recall: stacks and queues
Priority Queues & Heaps
CSE 12 – Basic Data Structures
Python: Stacks and Queues (as an Array)
Queues: Implemented using Linked Lists
Presentation transcript:

Data Structures: Advanced Damian Gordon

Advanced Data Structure We’ll look at: – Linked Lists – Trees – Stacks – Queues

Linked Lists Imagine we wanted to have an array where we can dynamically add elements into it, and take them away. We can do this with a linked list.

Linked Lists A linked list is made up of nodes.

Linked Lists A linked list is made up of nodes. Each node has two parts to it:

Linked Lists A linked list is made up of nodes. Each node has two parts to it: PointerValue

Linked Lists For example

Linked Lists For example 23

Linked Lists For example 2362

Linked Lists For example

Linked Lists For example

Linked Lists For example

Linked Lists For example Start of List End of List

Linked Lists To add a value in:

Linked Lists To add a value in:

Linked Lists To add a value in:

Linked Lists To add a value in:

Linked Lists To add a value in:

Linked Lists To delete a value:

Linked Lists To delete a value:

Linked Lists To delete a value:

Trees We can also have a tree:

Trees We can also have a tree: A tree is made up of nodes. Each node has three parts.

Trees We can also have a tree: A tree is made up of nodes. Each node has three parts. A value and two pointers, a left and a right one. Value RightLeft

Trees This is what it looks like:

Trees This is what it looks like: Root Parent Child 77 Leaf 27

Stacks We can also have a stack:

Stacks We can also have a stack:

Stacks We can also have a stack: It’s a structure that conforms to the principle of Last In, First Out (LIFO). The last item to join the stack is the first item to be served.

Stacks

Stacks Top Bottom

Stacks Values are added to the top:

Stacks Values are added to the top:

Stacks Values are added to the top:

Stacks Values are added to the top:

Stacks Values are removed from the top:

Stacks Values are removed from the top:

Stacks Values are removed from the top:

Queues We can also have a queue:

Queues We can also have a queue:

Queues We can also have a queue: It’s a structure that conforms to the principle of First In, First Out (FIFO). The first item to join the queue is the first item to be served.

Queues

Queues Back Front

Queues Values are added to the back:

Queues Values are added to the back:

Queues Values are added to the back:

Queues Values are removed from the front:

Queues Values are removed from the front:

Queues Values are removed from the front:

Queues Values are removed from the front:

etc.