Review 1 Polish Notation Prefix Infix Postfix Precedence of Operators Converting Infix to Postfix Evaluating Postfix.

Slides:



Advertisements
Similar presentations
Linked Lists Mohammed Almashat CS /03/2006.
Advertisements

Lists CS 3358.
Stacks, Queues, and Linked Lists
Linked Lists.
Linear Lists – Linked List Representation
Linked List Variations
§3 The Stack ADT 1. ADT A stack is a Last-In-First-Out (LIFO) list, that is, an ordered list in which insertions and deletions are.
Chapter 17 Linked List Saurav Karmakar Spring 2007.
M180: Data Structures & Algorithms in Java
Linked Lists Compiled by Dr. Mohammad Alhawarat CHAPTER 04.
Linked Lists. Example We would like to keep a list of inventory records – but only as many as we need An array is a fixed size Instead – use a linked.
Class 3: Linked Lists. cis 335 Fall 2001 Barry Cohen What is a linked list? n A linked list is an ordered series of ‘nodes’ n Each node contains some.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 13 Pointers and Linked Lists.
Main Index Contents 11 Main Index Contents Abstract Model of a List Obj. Abstract Model of a List Obj. Insertion into a List Insertion into a List Linked.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 17 Linked.
Summary of lectures (1 to 11)
Stacks CS-240 & CS-341 Dick Steflik. Stacks Last In, First Out operation - LIFO As items are added they are chronologically ordered, items are removed.
Variations of Linked Lists CS 308 – Data Structures.
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.
Algorithms and Data Structures Representing Sequences by Arrays and Linked Lists.
Self Referential Structure. A structure may not contain a member of its own type. struct check { int item; struct check n; // Invalid };
Stack  A stack is a linear data structure or abstract data type for collection of items, with the restriction that items can be added one at a time and.
Data Structures Using C++ 2E Chapter 7 Stacks. Data Structures Using C++ 2E2 Objectives Learn about stacks Examine various stack operations Learn how.
Week7 Stack Data Structures & Algorithms. Introduction to Stacks and Queues Widely used data structures Ordered List of element Easy to implement Easy.
CHAPTER 05 Compiled by: Dr. Mohammad Omar Alhawarat Stacks & Queues.
Review 1 Introduction Representation of Linear Array In Memory Operations on linear Arrays Traverse Insert Delete Example.
Implementation of Linked List For more notes and topics visit: eITnotes.com.
DATA STRUCTURE & ALGORITHMS CHAPTER 3: STACKS. 2 Objectives In this chapter, you will: Learn about stacks Examine various stack operations Discover stack.
Linked Lists part 2 CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer Science University.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 18: Stacks and Queues (part 2)
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
Week 4 - Monday.  What did we talk about last time?  Queues  Implementing queues with circular arrays.
The List ADT A sequence of zero or more elements A 1, A 2, A 3, … A N-1 N: length of the list A 1 : first element A N-1 : last element A i : position i.
APS105 Lists. Structures Arrays allow a collection of elements –All of the same type How to collect elements of different types? –Structures; in C: struct.
Week 5 - Wednesday.  What did we talk about last time?  Recursion  Definitions: base case, recursive case  Recursive methods in Java.
CHP-3 STACKS.
2/21/20161 List Operations Advanced Programming Ananda Gunawardena.
 Array is a data structure were elements are stored in consecutive memory location.in the array once the memory is allocated.it cannot be extend any more.
Linked list: a list of items (nodes), in which the order of the nodes is determined by the address, called the link, stored in each node C++ Programming:
1 Linked List. Outline Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion.
Data Structure & Algorithms
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Linked Lists Outline Introduction Self-Referential Structures.
Single Linked Lists Objectives In this lesson, you will learn to: *Define single linked list *Identify the following types of linked lists: Single linked.
Doubly Linked List Exercises Sometimes it is useful to have a linked list with pointers to both the next and previous nodes. This is called a doubly linked.
Linked Lists Chapter Introduction To The Linked List ADT Linked list: set of data structures (nodes) that contain references to other data structures.
1 CMPT 117 Linked Lists (singly linked). 2 Problems with arrays  When an element is deleted from or inserted into an array, the rest of the array has.
Linked Lists Data Structures and Algorithms CS 244 Brent M. Dingle, Ph.D. Department of Mathematics, Statistics, and Computer Science University of Wisconsin.
1 Data Structures and Algorithms Stack. 2 The Stack ADT Introduction to the Stack data structure Designing a Stack class using dynamic arrays Linked Stacks.
Data Structure and Algorithm: CIT231 Lecture 6: Linked Lists DeSiaMorewww.desiamore.com/ifm1.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Copyright © 2012 Pearson Education, Inc. Chapter 17: Linked Lists.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
STACKS & QUEUES for CLASS XII ( C++).
Data Structure By Amee Trivedi.
UNIT – I Linked Lists.
MEMORY REPRESENTATION OF STACKS
Lecture No.06 Data Structures Dr. Sohail Aslam
Program to search an element of array using linear search.
Objectives In this lesson, you will learn to: Define stacks
Sequences 9/18/ :20 PM C201: Linked List.
STACK By:- Rajendra ShakyawalP.G.T. Computer Science KV-No.1, AFS, Tambaram, Chennai.
Stacks, Queues, and Deques
Stack and Queues Stack implementation using Array
Stack and Queues Stack implementation using Array
Stacks and Queues 1.
Chapter 17: Linked Lists.
Stacks Data structure Elements added, removed from one end only
CS148 Introduction to Programming II
CS148 Introduction to Programming II
LINEAR DATA STRUCTURES
Presentation transcript:

Review 1 Polish Notation Prefix Infix Postfix Precedence of Operators Converting Infix to Postfix Evaluating Postfix

Polish Notation 2 Converting Infix to Postfix Converting Postfix to Infix Converting Infix to Prefix Examples

3 Converting Infix to Postfix

Examples 4 Converting Infix to Postfix

Examples 5 Converting Infix to Postfix

Examples 6 Converting Postfix to Infix

Examples 7 Converting Postfix to Infix

Examples 8 Converting Infix to Prefix

Examples 9 Converting Infix to Prefix

Summary 10 Converting Infix to Postfix Converting Postfix to Infix Converting Infix to Prefix Examples

Review 11 Polish Notation Prefix Infix Postfix Precedence of Operators Converting Infix to Postfix Evaluating Postfix

Polish Notation 12 Converting Infix to Postfix Converting Postfix to Infix Converting Infix to Prefix Examples

Linked Lists Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion

Outline Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion

Introduction Definitions Lists and arrays Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages

Introduction Definitions Lists and arrays Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages

Lists and arrays Lists:

Lists and arrays Arrays: {Size of the following array is = 4} Index0123 Value445963

Introduction Definitions Lists and arrays Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages

Nodes and pointers

Introduction Definitions Lists and arrays Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages

Single linked lists

Introduction Definitions Lists and arrays Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages

Double Linked Lists

Introduction Definitions Lists and arrays Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages

Circular Lists

Introduction Definitions Lists and arrays Nodes and pointers Single Linked Lists Double Linked Lists Circular Lists Advantages

The Linked List advantages are collected because of the array disadvantages, array disadvantages are: 1. Array Size 2. Memory allocation 3. Insertion and Deletion

Outline Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion

Insertion Description Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list

Insertion Description Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list

Insertion at the top Steps: Create a Node Set the node data Values Connect the pointers

Insertion Description Follow the previous steps and we get head // head 93 Step 1 Step 2 Step 3

Insertion Description Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list

Insertion at the end Steps: Create a Node Set the node data Values Connect the pointers

Insertion Description Follow the previous steps and we get head // Step 1 Step 2 Step 3

Insertion Description Insertion at the top of the list Insertion at the end of the list Insertion in the middle of the list

Insertion in the middle Steps: Create a Node Set the node data Values Break pointer connection Re-connect the pointers

Insertion Description Step 1 Step 2 Step 3 Step 4

Outline Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion

Deletion Description Deleting from the top of the list Deleting from the end of the list Deleting from the middle of the list

Deletion Description Deleting from the top of the list Deleting from the end of the list Deleting from the middle of the list

Deleting from the top Steps Break the pointer connection Re-connect the nodes Delete the node

Deletion Description 417 head head head 42

Deletion Description Deleting from the top of the list Deleting from the end of the list Deleting from the middle of the list

Deleting from the end Steps Break the pointer connection Set previous node pointer to NULL Delete the node

Deletion Description 417 head head head

Deletion Description Deleting from the top of the list Deleting from the end of the list Deleting from the middle of the list

Deleting from the Middle Steps Set previous Node pointer to next node Break Node pointer connection Delete the node

Deletion Description head 417 head 42 4 head 42

Outline Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion

Basic Node Implementation The following code is written in C++: Struct Node { int data; //any type of data could be another struct Node *next; //this is an important piece of code “pointer” };

Summary Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion