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
Scenario You work for a small company that exports artisan chocolate. Although you measure your products in kilograms, you often get orders in both pounds and ounces. You have decided that rather than have to look up conversions all the time, you could use Python code to take inputs to make conversions between the different units of measurement. You will write three blocks of code. The first will convert kilograms to pounds and ounces. The second will convert pounds to kilograms and ounces. The third will convert ounces to kilograms and pounds. The conversions are as follows: 1 kilogram = 35.274 ounces 1 kilogram = 2.20462 pounds 1 pound = 0.453592 kilograms 1 pound = 16 ounces 1 ounce = 0.0283 kilograms 1 ounce = 0.0625 pounds For the purposes of this activity the template for a function has been provided. You have not yet covered functions in the course, but they are a way of reusing code. Like a Python script, a function can have zero or more parameters. In the code window you…
make a screen capture showing the StegExpose results
Which of the following is not one of the recommended criteria for strategic objectives? Multiple Choice   a) realistic   b) appropriate   c) sustainable   d) measurable

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
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,