In C, define: List addAt(List head, int item,int pos);

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
icon
Concept explainers
Question

In C, define: List addAt(List head, int item,int pos);

List addFront (List head, int item){
nodeptr temp=createNode (item); //
1-2
}
1-2
//3 the predecessor is head
temp->next=head; //4
List addEnd (List head, int item) {
nodeptr temp=createNode(item);//
}
head-temp; //5
return head;
nodeptr ptr;
1/3
ptr=head;
while(ptr->next !=NULL)
ptr=ptr->next;
//4 temp->next is already NULL
ptr->next-temp;
return head;
List addAt (List head, int item, int
pos);
Transcribed Image Text:List addFront (List head, int item){ nodeptr temp=createNode (item); // 1-2 } 1-2 //3 the predecessor is head temp->next=head; //4 List addEnd (List head, int item) { nodeptr temp=createNode(item);// } head-temp; //5 return head; nodeptr ptr; 1/3 ptr=head; while(ptr->next !=NULL) ptr=ptr->next; //4 temp->next is already NULL ptr->next-temp; return head; List addAt (List head, int item, int pos);
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Linked List
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.
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr