
Systems Architecture
7th Edition
ISBN: 9781305080195
Author: Stephen D. Burd
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
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.
- Move pointer “ptr” to the pointer next node.
- Iterate the “while” loop until last node becomes “null”.
- 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.
- Call the function “insert_element()” to insert each element in the list.
Expert Solution & Answer

Want to see the full answer?
Check out a sample textbook solution
Students have asked these similar questions
What is the ALU result if the 4-bit ALU Control signal is 0100? What happens if the ALU Control signal is 0101?
#include
int main (void)
{
int i, *p, count
}
p
=
&count;
= 10%;
for (i = 5; i >= 0; i--) {
count++;
(*p) ++;
}
printf("count
return 0;
=
%d, Have a wonderful day.\n", count);
1. [20 pts] What is the output of the program? Please explain why.
2. [15 pts] What is the gdb command to set a breakpoint in line 6 (p
=
&count;)?
3. [15 pts] Explain in your own words how the [break.
need to use such command?
...
if expr] command works. When might you
Please run and debug the following program and answer the questions.
Chapter 3 Solutions
Systems Architecture
Ch. 3 - Prob. 1VECh. 3 - Prob. 2VECh. 3 - A(n) __________ is an integer stored in double the...Ch. 3 - Prob. 4VECh. 3 - Assembly (machine) language programs for most...Ch. 3 - Prob. 6VECh. 3 - Prob. 7VECh. 3 - Prob. 8VECh. 3 - Prob. 9VECh. 3 - A(n) __________ is an array of characters.
Ch. 3 - Most Intel CPUs use the __________, in which each...Ch. 3 - Prob. 12VECh. 3 - A(n) __________ contains 8 __________.Ch. 3 - Prob. 14VECh. 3 - The result of adding, subtracting, or multiplying...Ch. 3 - Prob. 16VECh. 3 - Prob. 17VECh. 3 - Prob. 18VECh. 3 - Prob. 19VECh. 3 - Prob. 20VECh. 3 - Prob. 21VECh. 3 - Prob. 22VECh. 3 - ___________ occurs when the result of an...Ch. 3 - In a CPU, _______ arithmetic generally is easier...Ch. 3 - In the ________, memory addresses consist of a...Ch. 3 - Prob. 26VECh. 3 - Data represented in ________ is transmitted...Ch. 3 - Prob. 28VECh. 3 - Prob. 29VECh. 3 - A(n) ____________ is one instance or variable of a...Ch. 3 - Prob. 1RQCh. 3 - Why is binary data representation and signaling...Ch. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Why doesnt a CPU evaluate the expression 'A' = 'a'...Ch. 3 - Prob. 9RQCh. 3 - What primitive data types can normally be...Ch. 3 - Prob. 11RQCh. 3 - How is an array stored in main memory? How is a...Ch. 3 - Prob. 14RQCh. 3 - Prob. 1PECh. 3 - Prob. 2PECh. 3 - Prob. 4PECh. 3 - Prob. 5PECh. 3 - Prob. 6PECh. 3 - Prob. 1RPCh. 3 - Prob. 2RPCh. 3 - Prob. 3RP
Knowledge Booster
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
- (OnlineGDB) #include <stdio.h>int main(void) {int a;char *s;int v0 = 4, v1 = 5, v2 = 6, v3 = 1, v4 = 2;printf("Exercise 1:\n====================\n");switch(v0) {case 0: printf("Hello October\n"); break;case 1: printf("Go Kean!\n"); break;case 2: printf("Academic Building Center \n"); break;case 3: printf("UNION \n"); break;case 4: printf("Go ");case 5: printf("Kean! \n");default: printf("Have a great semester! \n"); break;}for(a=5; a<v1; a++) {printf("Kean");}printf("\n");if (v2 == 6) {s = "Go";}else {s = "Hello";}if(v3 != v4) {printf("%s Kean!\n",s);} else {printf("%s Computer Science!\n",s);}return 0;} Assume the following codes are added between line 36 (}) and line 38 (return 0;) v0>0 ? ++v1, ++v2 : --v3; Please give the values of v0, v1, v2, v3, and v4 after this line and explain the reason. You can test the program to verify your answer if you like.arrow_forward#include <stdio.h>int main(void) {int a;char *s;int v0 = 4, v1 = 5, v2 = 6, v3 = 1, v4 = 2;printf("Exercise 1:\n====================\n");switch(v0) {case 0: printf("Hello October\n"); break;case 1: printf("Go Kean!\n"); break;case 2: printf("Academic Building Center \n"); break;case 3: printf("UNION \n"); break;case 4: printf("Go ");case 5: printf("Kean! \n");default: printf("Have a great semester! \n"); break;}for(a=5; a<v1; a++) {printf("Kean");}printf("\n");if (v2 == 6) {s = "Go";}else {s = "Hello";}if(v3 != v4) {printf("%s Kean!\n",s);} else {printf("%s Computer Science!\n",s);}return 0;} Output: Exercise 1:====================Go Kean! Have a great semester! Go Kean! Please only modify the initial value of v0, v1, v2, v3 and v4 to get the following output. Youneed to show your program output (in the screenshot) and submit the code that youmodified.Exercise 1:====================Hello OctoberKeanHello Computer Science!arrow_forward(OnlineGDB) 1. Please read and run the following code and answer the questions.#include <stdio.h>int main(void) {int a;char *s;int v0 = 4, v1 = 5, v2 = 6, v3 = 1, v4 = 2;printf("Exercise 1:\n====================\n");switch(v0) {case 0: printf("Hello October\n"); break;case 1: printf("Go Kean!\n"); break;case 2: printf("Academic Building Center \n"); break;case 3: printf("UNION \n"); break;case 4: printf("Go ");case 5: printf("Kean! \n");default: printf("Have a great semester! \n"); break;}for(a=5; a<v1; a++) {printf("Kean");}printf("\n");if (v2 == 6) {s = "Go";}else {s = "Hello";}if(v3 != v4) {printf("%s Kean!\n",s);} else {printf("%s Computer Science!\n",s);}return 0;} What is the output of the program? Please explain why.arrow_forward
- 1.[30 pts] Answer the following questions: a. [10 pts] Write a Boolean equation in sum-of-products canonical form for the truth table shown below: A B C Y 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 a. [10 pts] Minimize the Boolean equation you obtained in (a). b. [10 pts] Implement, using Logisim, the simplified logic circuit. Include an image of the circuitarrow_forwardIn the past, encryption and decryption were mostly done by substitution and permutation of letters in a text message. study those classic cryptographic schemes Then, develop an automatic cipher using Javascript The cipher should be able to perform the following tasks: generate keys encrypt a given plaintext message with a key selected from the list of keys generated decrypt a given ciphertext message with a known cipher keyarrow_forwardList reasons why teachers should and shouldn’t be replaced by computers? State your response in a descriptive context. Provide five references from the with internet with your answers.arrow_forward
- The attached picture shows the RTCAPI memory mapped register which has the address 0x180. 1) Program the MCU's registers so that a) SIRC is the clock source b) the clock is divided by 16K c) the clock is enabled d) load is enabledarrow_forwardWhat is the ALU result if the 4-bit ALU Control signal is 0100? What happens if the ALU Control signal is 0101?arrow_forwardIn the past, encryption and decryption were mostly done by substitution and permutation of letters in a text message. study those classic cryptographic schemes Then, develop an automatic cipher using a programming language of your choice. The cipher should be able to perform the following tasks: generate keys encrypt a given plaintext message with a key selected from the list of keys generated decrypt a given ciphertext message with a known cipher keyarrow_forward
- Case Study Instructions: Offshore Wind Energy in the North Sea For this case study, students will analyze the institutional challenges and social rules surrounding offshore wind energy development in the Dutch North Sea, as explored in the case study from the textbook (pages 44-46). Additional resources in this week’s learning module will provide further perspectives on the impact of wind energy on different stakeholders. Students should refer to the syllabus for specific guidelines regarding length, format, and content requirements. Reflection Questions to Consider: What are the key institutional challenges in implementing offshore wind energy in the North Sea? How do formal and informal social rules shape the use of this shared space? What conflicts arise between different stakeholders (e.g., fishermen, naval transport, military, and wind energy developers)? How can policymakers balance economic, environmental, and social considerations when allocating space for wind energy?…arrow_forwardAlphabetic Telephone Number TranslatorMany companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion: A, B, and C = 2 D, E, and F = 3 G, H, and I = 4 J, K, and L = 5 M, N, and O = 6 P, Q, R, and S = 7 T, U, and V = 8 W, X, Y, and Z = 9 Write a program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD, the application should display 555-438-3663.arrow_forwardI would like help to resolve the following casearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,

Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr

New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning

C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage

Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,