Using the List codes, write a program to implement the following operations: 1) Create a list that has the following elements: <2; 23; 15; 5; 9 >; 2) Print the elements of the list: 3) Insert an element with value 20 before 5, and then print the eleme nts of the list; 4) Print the position of the current element; 5) Print the value of the next element. Output Example: <12 23 15 5 9> <223 15 | 20 5 9> Current pos is 3 next value is 5

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 1VE
icon
Related questions
Question

C++

Hw Chapter 4 Lists Insert an element and search
Description:
Using the List codes, write a program to implement the following operations:
1) Create a list that has the following elements: <2; 23; 15; 5; 9 >;
2) Print the elements of the list;
3) Insert an element with value 20 before 5, and then print the eleme
nts of the list;
4) Print the position of the current element;
5) Print the value of the next element.
Output Example:
<|2 23 15 5 9>
<2 23 15 | 20 5 9>
Current pos is 3
next value is 5
Transcribed Image Text:Hw Chapter 4 Lists Insert an element and search Description: Using the List codes, write a program to implement the following operations: 1) Create a list that has the following elements: <2; 23; 15; 5; 9 >; 2) Print the elements of the list; 3) Insert an element with value 20 before 5, and then print the eleme nts of the list; 4) Print the position of the current element; 5) Print the value of the next element. Output Example: <|2 23 15 5 9> <2 23 15 | 20 5 9> Current pos is 3 next value is 5
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Linked List Representation
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
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning