CS148 Introduction to Programming II

Slides:



Advertisements
Similar presentations
Lecture Computer Science I - Martin Hardwick Strings #include using namespace std; int main () { string word; cout
Advertisements

Linked Lists Mohammed Almashat CS /03/2006.
Inserting a Node into a Specified Position of a Linked List To create a node for the new item newNode = new Node(item); To insert a node between two nodes.
Linear Lists – Linked List Representation
Data Structure Lecture-5
Lecture 20: 11/12/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Chapter 17 Linked List Saurav Karmakar Spring 2007.
Lecture 18: 4/11/2003CS148 Spring CS148 Introduction to Programming II Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Computer Programming Link List (Insertion, Printing and Deletion functions) Lecture 23.
Advance Data Structure 1 College Of Mathematic & Computer Sciences 1 Computer Sciences Department م. م علي عبد الكريم حبيب.
CS 206 Introduction to Computer Science II 02 / 06 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 09 / 17 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 09 / 15 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 02 / 09 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 09 / 19 / 2008 Instructor: Michael Eckmann.
Lecture 14 Linked Lists 14-1 Richard Gesick. Linked Lists Dynamic data structures can grow and shrink at execution time. A linked list is a linear collection.
CS 1031 Linked Lists Definition of Linked Lists Examples of Linked Lists Operations on Linked Lists Linked List as a Class Linked Lists as Implementations.
Department of Computer Science Data Structures Using C++ 2E Chapter 5 Linked Lists.
Introduction to C Programming CE Lecture 24 Insertion and Deletion with Binary Search Trees.
Review 1 Polish Notation Prefix Infix Postfix Precedence of Operators Converting Infix to Postfix Evaluating Postfix.
Data Structures Using C++1 Chapter 5 Linked Lists.
Algorithms and Data Structures
 Head pointer  Last node  Build a complete linked list  Node deletion  Node insertion  Helpful hints.
Lecture 10: 2/17/2003CS148 Spring CS148 Introduction to Programming II Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
CSC 205 Programming II Lecture 15 Linked List – Other Variations.
Department of Computer Science 1 Some Practice Let’s practice for the final a little bit. OK?
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:
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Dale Roberts, Lecturer Data Structure.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Linked Lists Outline Introduction Self-Referential Structures.
Lecture 17: 4/4/2003CS148 Spring CS148 Introduction to Programming II Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
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.
CS32 Discussion Section 1B Week 3 TA: Hao Yu (Cody)
Copyright © 2012 Pearson Education, Inc. Chapter 17: Linked Lists.
CPSC 252 Linked Lists III Page 1 Variations on Singly Linked Lists Inserting or deleting at the front of a list is different from at any other point in.
C++ Programming:. Program Design Including
ECE Application Programming
UNIT – I Linked Lists.
CMSC202 Computer Science II for Majors Lecture 12 – Linked Lists
Review Deleting an Element from a Linked List Deletion involves:
Sequences 6/18/2018 8:51 PM C201: Linked List.
Linked List.
Abstract Data Types Polynomials CSCI 240
UNIT-3 LINKED LIST.
Linked lists.
Sequences 9/18/ :20 PM C201: Linked List.
CS149D Elements of Computer Science
CS149D Elements of Computer Science
CS148 Introduction to Programming II
CS170 Computer Organization and Architecture I
Sequences 11/27/2018 1:37 AM Singly Linked Lists Singly Linked Lists.
Cs212: Data Structures Computer Science Department Lab 7: Stacks.
CS148 Introduction to Programming II
Doubly Linked Lists Lecture 21 Tue, Mar 21, 2006.
Chapter 17: Linked Lists.
CS170 Computer Organization and Architecture I
CS148 Introduction to Programming II
CS149D Elements of Computer Science
CS148 Introduction to Programming II
CS149D Elements of Computer Science
CS149D Elements of Computer Science
CS148 Introduction to Programming II
Linked lists.
CS148 Introduction to Programming II
CS148 Introduction to Programming II
More on Linked List Yumei Huo Department of Computer Science
Introduction to Digital Libraries Assignment #1
Linked Lists Dr. Jose Annunziato.
CS148 Introduction to Programming II
Linked Lists.
Presentation transcript:

CS148 Introduction to Programming II Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture 13: 2/28/2003 Lecture 13: 2/28/2003 CS148 Spring 2003

Outline Operations on linked lists Insertion in a sorted linked list Deletion from a linked list Lecture 13: 2/28/2003 CS148 Spring 2003

Linked Lists struct node { int ID; //Node ID string name; Data Component Link A node in a linked list struct node { int ID; //Node ID string name; node* next; //pointer to next node }; HEAD 1 2 (N-1) N points to NULL (the end of the list) A linked list (HEAD gives the location of the first node in the list) Lecture 13: 2/28/2003 CS148 Spring 2003

Insertion in order struct node { int ID; //Node ID string name; node* next; //pointer to next node }; HEAD 1 2 8 9 5 Old link NewNode previous current previous->next= NewNode; NewNode->next = current; Lecture 13: 2/28/2003 CS148 Spring 2003

Deletion of a node struct node { int ID; //Node ID string name; node* next; //pointer to next node }; HEAD 1 2 8 9 previous current Delete this node previous->next = current->next; delete current; Lecture 13: 2/28/2003 CS148 Spring 2003