Systems Architecture
Systems Architecture
7th Edition
ISBN: 9781305080195
Author: Stephen D. Burd
Publisher: Cengage Learning
bartleby

Concept explainers

Question
Book Icon
Chapter 3, Problem 1PE
Program Plan Intro

Inserting an element to linked list after the address of the element

Program Plan:

  • Include required header files.
  • Create a structure for “Node”.
    • Declare a variable “element” to store the numeric values.
    • Declare a pointer “next” to store the address of the next link.
  • Define the function “insert_in_linked_list()”.
    • Declare a local pointer “ptr”.
    • Assign value for “ptr”.
    • Assign memory space for new node and place data value in it.
    • Link the new node.
    • Place the element in the list.
    • Link new node to the list.
  • Define the function “insert_element()” to add an element to the end of the list.
    • Iterate the “while” loop until last node becomes “null”.
      • Move pointer “ptr” to the pointer next node.
        • Assign memory allocation for the new node.
        • Create the new assigned memory space to the pointer “ptr”.
        • Place the element in the list.
        • Set “NULL” to the mark the end of the list.
  • Define the function “display_list()” to display all elements in the list.
    • If the “ptr” is null, then returns null.
    • Print the element in the list.
    • Call the function “display_list()” recursively with next element of the list.
  • Define main() function.
    • Declare required variables.
    • Declare pointer objects using structure.
    • Assign memory allocation for first element of list.
    • Set next of first element to “NULL”.
    • Use “for” loop to iterate 10 elements in the list.
      • Call the function “insert_element()” to insert each element in the list.
        • Call the function “display_list()” to display the elements in the list.
        • Read the element from user.
        • Read the index of new element from the user.
        • Set the temp pointer.
        • Use “for” loop to search for index value entered by the user.
          • Check condition and if the condition satisfies, then store the address in the pointer “temp_ptr”.
        • Call the function “insert_in_linked_list” with “add_element” and “temp_ptr”.
        • Call the function “display_list()” to display the elements of the list.

Blurred answer
Students have asked these similar questions
Data structures concatenate_dict(dict_list:list)->dict This function will be given a single parameter known as the Dictionary List. Your job is to combine all the dictionaries found in the dictionary list into a single dictionary and return it. There are two rules for adding values to the dictionary: 1. You must add key-value pairs to the dictionary in the same order they are found in the Dictionary List. 2. If the key already exists, it cannot be overwritten. In other words, if two or more dictionaries have the same key, the key to be added cannot be overwritten by the subsequent dictionaries.   Example: Dictionary List: [{'Z': 6, 'k': 10, 'w': 3, 'I': 8, 'Y': 5}, {'Y': 1, 'Z': 4}, {'X': 2, 'L': 5}]
Expected: {'Z': 6, 'k': 10, 'w': 3, 'I': 8, 'Y': 5, 'X': 2, 'L': 5} Dictionary List: [{'z': 0}, {'z': 7}]
Expected: {'z': 0} Dictionary List: [{'b': 7}, {'b': 10, 'A': 8, 'Z': 2, 'V': 1}]
Expected: {'b': 7, 'A': 8, 'Z': 2, 'V': 1}
in c++ Create a single linked list that contains the data (age) of your friends. Perform basic operations including insertion, deletion, searching and display. The insertion operation should only allow a friend’s data to be inserted in sorted order only.
Using user-defined function, create a C++ or Java application implementing a linked list datastructure. The application should be able to perform the following operations on the datastructure can with the following operations. i. insertion into the listii. deletion from the list iii. printing the content of the list

Chapter 3 Solutions

Systems Architecture

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
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning