Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear.

Slides:



Advertisements
Similar presentations
Linked Lists.
Advertisements

Chapter 17 Linked Lists.
Stacks, Queues, and Linked Lists
Data Structures: A Pseudocode Approach with C
DATA STRUCTURES USING C++ Chapter 5
Data Structures Intro/Linked List Review CIS 237 – Data Structures.
Linear ADT Done By : Kishan Gopaul.
Ceng-112 Data Structures I Chapter 5 Queues.
Review Learn about linked lists
Data Structures: A Pseudocode Approach with C
Ceng-112 Data Structures I 1 Chapter 3 Linear Lists.
COSC 1P03 Data Structures and Abstraction 5.1 Linear Linked Structures.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 excerpts Graphs (breadth-first-search)
Binary Search Trees Briana B. Morrison Adapted from Alan Eugenio.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
COMP103 - Linked Lists (Part A)1 Chapter 17 Truly dynamic memory management.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
Data Structures Using C++ 2E Chapter 11 Binary Trees and B-Trees.
1 Fall Chapter 4 ADT Sorted List. 2 Goals Describe the Abstract Data Type Sorted List from three perspectives Implement the following Sorted List.
Data Structures Using C++ 2E
Binary Search Trees Chapter 7 Objectives
Ceng-112 Data Structures ITurgut Kalfaoglu 1 Chapter 3 Stacks.
Chapter 4 Stacks Stacks A stack is a linear data structure that can be accessed only at one of its ends for storing and retrieving. Its called.
SAK 3117 Data Structures Chapter 6: LINKED LISTS.
Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.
Trees Chapter 15 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
CS Data Structures Chapter 15 Trees Mehmet H Gunes
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
Standard Algorithms –search for an item in an array –count items in an array –find the largest (or smallest) item in an array.
Tree (new ADT) Terminology:  A tree is a collection of elements (nodes)  Each node may have 0 or more successors (called children)  How many does a.
CSC 211 Data Structures Lecture 13
1 Chapter 10 Trees. 2 Definition of Tree A tree is a set of linked nodes, such that there is one and only one path from a unique node (called the root.
A first look an ADTs Solving a problem involves processing data, and an important part of the solution is the careful organization of the data In order.
Chapter 9 slide 1 Introduction to Search Algorithms Search: locate an item in a list (array, vector, table, etc.) of information Two algorithms (methods):
Linked List Chapter Data Abstraction separates the logical properties of a data type from its implementation LOGICAL PROPERTIES – What are the.
COSC 1P03 Data Structures and Abstraction 5.1 Linear Linked Structures A bank is a place where they lend you an umbrella in fair weather and ask for it.
1 Chapter 7 Objectives Upon completion you will be able to: Create and implement binary search trees Understand the operation of the binary search tree.
Ceng-112 Data Structures ISerap ATAY, Ph. D. 1 Chapter 3 – Part 2 Linear Lists.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
Copyright © 2012 Pearson Education, Inc. Chapter 20: Binary Trees.
Chapter 17: Linked Lists. Objectives In this chapter, you will: – Learn about linked lists – Learn the basic properties of linked lists – Explore insertion.
An algorithm of Lock-free extensible hash table Yi Feng.
Data Structures AZHAR MAQSOOD NUST Institute of Information Technology (NIIT) Lecture 6: Linked Lists Linked List Basics.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
1 Chapter 4 Unordered List. 2 Learning Objectives ● Describe the properties of an unordered list. ● Study sequential search and analyze its worst- case.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 18: Linked Lists.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 20: Binary Trees.
Stacks Chapter 3 Objectives Upon completion you will be able to
LINKED LISTS.
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Objectives Upon completion you will be able to: Explain the design, use, and operation of a linear.
Data Structures( 数据结构 ) Chapter3:Linked List. 2 西南财经大学天府学院 Vocabulary Linear List 线性表 Linked List 链表 Retrieval 检索 Traversal 遍历 Node 结点 Circularly Linked.
1 Data Structures and Algorithms Linked List. 2 Lists Lists The Linked List ADT Linked List The Linked List Class Definition Linked List Class implementation.
Chapter 16: Linked Lists.
CSCE 210 Data Structures and Algorithms
C++ Programming:. Program Design Including
Stacks and Queues Chapter 4.
Chapter 15 Lists Objectives
Binary Search Trees Chapter 7 Objectives
UNIT-3 LINKED LIST.
Lecture 22 Binary Search Trees Chapter 10 of textbook
Queues Chapter 4.
Data Structures: A Pseudocode Approach with C
Chapter 20: Binary Trees.
Chapter 21: Binary Trees.
Chapter 15 Lists Objectives
Binary Search Trees Chapter 7 Objectives
Linked Lists Chapter 5 (continued)
Applications of Arrays
Presentation transcript:

Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear list using a linked list structure Understand the operation of the linear list ADT Application programs using the linear list ADT Design and implement different link-list structures List

Data Structures: A Pseudocode Approach with C 2 List Search A list search is used by algorithms to locate data in a list. To insert data, we need to know the logical predecessor to the new data. To delete data, we need to know the node to be deleted and identify it’s logical predecessor. To retrieve data, we need to search the list and find the data. Sequential search is used for list search because there is no physical relationship among the nodes;returns the locations of an element. If not found, returns the location of last element. Given a target key in the ordered list, if a node in the list matches the target value, the search returns true. If no key matches found, it returns false.

Data Structures: A Pseudocode Approach with C 3

4 List Search contd. Start at the beginning of the list and search until the target value is not greater than the current node’s key. At this point the target is either less than or equal to the current node’s key while the predecessor is pointing to the node immediately before the current nodes. Test the current node and return true if the target value is equal to the list value or false if it is less and terminate the search.

Data Structures: A Pseudocode Approach with C 5

6 Retrieve Node Retrieve node uses search node to locate the data in the list. If the data are found, it moves the data to the output area in the calling module and returns true. If data are not found, returns false.

Data Structures: A Pseudocode Approach with C 7 Empty List A simple module that returns true or false indicating that there are data in the list or the list is empty.

Data Structures: A Pseudocode Approach with C 8 Full List As with many other languages, C does not provide how much memory is left in dynamic memory.

Data Structures: A Pseudocode Approach with C 9 List Count List count returns the number of nodes in the current nodes.

Data Structures: A Pseudocode Approach with C 10 Traverse List Traversal starts at the first node and examines each node in the succession until the last node has been processed. Each loop calls a process module and passes it the data and then advances the walking pointer to the next node. Because we need to remember where we are in the list from one call to the next, we need to add a current position pointer to the head structure. Each call needs to know whether it is starting from the beginning of the list or continuing from the last node processed. This information is communicated through the parameter list.

Data Structures: A Pseudocode Approach with C 11

Data Structures: A Pseudocode Approach with C 12 Destroy List When the list is no longer needed and the application is not done, the list should be destroyed. Destroy list deletes any nodes still in the list and recycles their memory and set the metadata to a null list condition

Data Structures: A Pseudocode Approach with C 13 Implementation We begin with a discussion of the data structure required to support a list. We then develop the 10 basic algorithms required to build and use a list. In developing the insertion and deletion algorithms, we use extensive examples to demonstrate the analytical steps used in developing algorithms. Data Structure Algorithms

Data Structures: A Pseudocode Approach with C 14

Data Structures: A Pseudocode Approach with C 15

Data Structures: A Pseudocode Approach with C 16

Data Structures: A Pseudocode Approach with C 17

Data Structures: A Pseudocode Approach with C 18

Data Structures: A Pseudocode Approach with C 19

Data Structures: A Pseudocode Approach with C 20

Data Structures: A Pseudocode Approach with C 21

Data Structures: A Pseudocode Approach with C 22

Data Structures: A Pseudocode Approach with C 23

Data Structures: A Pseudocode Approach with C 24

Data Structures: A Pseudocode Approach with C 25

Data Structures: A Pseudocode Approach with C 26

Data Structures: A Pseudocode Approach with C 27

Data Structures: A Pseudocode Approach with C 28

Data Structures: A Pseudocode Approach with C 29

Data Structures: A Pseudocode Approach with C 30

Data Structures: A Pseudocode Approach with C 31

Data Structures: A Pseudocode Approach with C 32 List ADT example

Data Structures: A Pseudocode Approach with C 33

Data Structures: A Pseudocode Approach with C 34 (continued)

Data Structures: A Pseudocode Approach with C 36

Data Structures: A Pseudocode Approach with C 37

Data Structures: A Pseudocode Approach with C 38

Data Structures: A Pseudocode Approach with C 39

Data Structures: A Pseudocode Approach with C 40

Data Structures: A Pseudocode Approach with C 41

Data Structures: A Pseudocode Approach with C 42

Data Structures: A Pseudocode Approach with C 43

Data Structures: A Pseudocode Approach with C 44

Data Structures: A Pseudocode Approach with C 45

Data Structures: A Pseudocode Approach with C 46

Data Structures: A Pseudocode Approach with C 47

Data Structures: A Pseudocode Approach with C 48

Data Structures: A Pseudocode Approach with C 49

Data Structures: A Pseudocode Approach with C 50 (continued)

Data Structures: A Pseudocode Approach with C 51

Data Structures: A Pseudocode Approach with C 52