Starting Out with C++: Early Objects
Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
bartleby

Concept explainers

Question
Book Icon
Chapter 17, Problem 13RQE
Program Plan Intro

Linked list:

Linked list is a linear and dynamic data structure which is used to organize data; it contains sequence of elements which are connected together in memory to form a chain. The every element of linked list is called as a node.

List head:

List head is a pointer used to point the first node in the linked list and it is also called as “head pointer”; if the “head pointer” points to a “NULL” value, then it is considered that the “list is empty”.

Graphical representation of linked list:

The graphical representation of a linked list is as follows:

Starting Out with C++: Early Objects, Chapter 17, Problem 13RQE

Traversing the list:

Traversing the linked list is the process of visiting the list until reaching the last node. It is one of the operations in the list, which is used to visit each node exactly once in order to access the data stored in the list.

Steps to traversing a list:

The following steps are used to perform the traversing operation in a list.

Step 1: Move to the list head (first node).

Step 2: Retrieve the data from the head node and perform the necessary operation.

Step 3: After performing operation, move the pointer to next node and perform the operation until the end of the node.

Step 4: Perform all the above travelling nodes as a visited node.

Usage of traversing the list:

Print the elements.

  • Traversing the list used to display all elements from the list.

Count the elements.

  • Traversing the list used to count the number of elements available in the list.

Search the element.

  • Traversing the list used to search a particular value in the list.

Blurred answer
Students have asked these similar questions
Please show the code for the Tikz figure
What is Windows Server and what is the Differences between Windows Server 2019 and the Windows Operating System that people have installed on their personal computer.
solve and show the tree on paper
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT