Question Solved1 Answer C program to create a linked list and Insert an element after a particular element. If there are more than one similar elements in the linked list, add the element after the first occurrence. Sample Input/Output Input: 17 42 16 18 39 -999 16 87 Output 17 42 16 87 18 39

SMHMOQ The Asker · Computer Science

C program to create a linked list and Insert an element after a particular element. If there are more than one similar elements in the linked list, add the element after the first occurrence. Sample Input/Output

Input:

17 42 16 18 39 -999

16 87

Output

17 42 16 87 18 39

More
See Answer
Add Answer +20 Points
Community Answer
4ES2X4 The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

Step1/3C Program Screenshots :Explanation:Please refer to solution in this step.Step2/3Sample Output #1 :∼// RowdyGrippingQuadrant$ $// a.outEnter Values of linked list( -999 to stop) :1742161839-999Enter position and new values : 1687Linked list after inserting :174216871839∼// RowdyGrippingQuadrant$Sample Output #2 :When two similar elements exits then inserts after first occurrence.∼ /RowdyGrippingQuadrant$ $ /a.outEnter Values of linked list(-999 to stop) :562332121412523112-999Enter position and new values : 12250Linked list after inserting :562332122501412523112∼ /RowdyGrippingQuadrant$Sample Output #3 :When element not found inserts at end./RowdyGrippingQuadrant$ $ /a.outEnter Values of linked list( -999 to stop) :2030405060-999Enter position and new values : 7070Linked list after inserting :203040506070Explanation:Please refer to solution in this step.Step3/3.lcWjel{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;font-size:0.75rem;box-sizing:border-box;}/*!sc*/data-styled.g366[id="sc-mwpquf-0"]{content:"lcWjel,"}/*!sc*/.loOCZZ{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;}/*!sc*/.loOCZZ .align-left{text-align:left;}/*!sc*/.loOCZZ .align-center{text-align:center;}/*!sc*/.loOCZZ .align-right{text-align:right;}/*!sc*/data-styled.g367[id="sc-mwpquf-1"]{content:"loOCZZ,"}/*!sc*/.cpESDm .DraftEditor-editorContainer,.cpESDm .DraftEditor-root,.cpESDm .public-DraftEditor-content{height:inherit;text-align:initial;}/*!sc*/.cpESDm .public-DraftEditor-content[contenteditable='true']{-webkit-user-modify:read-write-plaintext-only;}/*!sc*/.cpESDm .DraftEditor-root{position:relative;}/*!sc*/.cpESDm .DraftEditor-editorContainer{background-color:rgba(255,255,255,0);border-left:0.1px solid transparent;position:relative;z-index:1;}/*!sc*/.cpESDm .public-DraftEditor-block{position:relative;}/*!sc*/.cpESDm .DraftEditor-alignLeft .public-DraftStyleDefault-block{text-align:left;}/*!sc*/.cpESDm .DraftEditor-alignLeft .public-DraftEditorPlaceholder-root{left:0;text-align:left;}/*!sc*/.cpESDm .DraftEditor-alignCenter .public-DraftStyleDefault-block{text-align:center;}/*!sc*/.cpESDm .DraftEditor-alignCenter .public-DraftEditorPlaceholder-root{margin:0 auto;text-align:center;width:100%;}/*!sc*/.cpESDm .DraftEditor-alignRight .public-DraftStyleDefault-block{text-align:right;}/*!sc*/.cpESDm .DraftEditor-alignRight .public-DraftEditorPlaceholder-root{right:0;text-align:right;}/*!sc*/.cpESDm .public-DraftEditorPlaceholder-root{color:#9197a3;position:absolute;width:100%;z-index:1;}/*!sc*/.cpESDm .public-DraftEditorPlaceholder-hasFocus{color:#bdc1c9;}/*!sc*/.cpESDm .DraftEditorPlaceholder-hidden{display:none;}/*!sc*/.cpESDm .public-DraftStyleDefault-block{position:relative;white-space:pre-wrap;}/*!sc*/.cpESDm .public-DraftStyleDefault-ltr{direction:ltr;text-align:left;}/*!sc*/.cpESDm .public-DraftStyleDefault-rtl{direction:rtl;text-align:right;}/*!sc*/.cpESDm .public-DraftStyleDefault-listLTR{direction:ltr;}/*!sc*/.cpESDm .public-DraftStyleDefault-listRTL{direction:rtl;}/*!sc*/.cpESDm .public-DraftStyleDefault-ol,.cpESDm .public-DraftStyleDefault-ul{margin:16px 0;padding:0;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listLTR{margin-left:1.5em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listRTL{margin-right:1.5em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listLTR{margin-left:3em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listRTL{margin-right:3em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listLTR{margin-left:4.5em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listRTL{margin-right:4.5em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listLTR{margin-left:6em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listRTL{margin-right:6em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listLTR{margin-left:7.5em;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listRTL{margin-right:7.5em;}/*!sc*/.cpESDm .public-DraftStyleDefault-unorderedListItem{list-style-type:square;position:relative;}/*!sc*/.cpESDm .public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth0{list-style-type:disc;}/*!sc*/.cpESDm .public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth1{list-style-type:circle;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem{list-style-type:none;position:relative;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listLTR:before{left:-36px;position:absolute;text-align:right;width:30px;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listRTL:before{position:absolute;right:-36px;text-align:left;width:30px;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem:before{content:counter(ol0) '. ';counter-increment:ol0;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth1:before{content:counter(ol1,lower-alpha) '. ';counter-increment:ol1;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth2:before{content:counter(ol2,lower-roman) '. ';counter-increment:ol2;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth3:before{content:counter(ol3) '. ';counter-increment:ol3;}/*!sc*/.cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth4:before{content:counter(ol4,lower-alpha) '. ';counter-increment:ol4;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-reset{counter-reset:ol0;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-reset{counter-reset:ol1;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-reset{counter-reset:ol2;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-reset{counter-reset:ol3;}/*!sc*/.cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-reset{counter-reset:ol4;}/*!sc*/.cpESDm .public-DraftStyleDefault-ltr{text-align:inherit;}/*!sc*/.cpESDm .public-DraftStyleDefault-rtl{text-align:inherit;}/*!sc*/data-styled.g370[id="sc-mwpquf-4"]{content:"cpESDm,"}/*!sc*/.jhimFq{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;box-sizing:border-box;border:2px solid transparent;}/*!sc*/.jhimFq h2{font-size:16px;}/* ... See the full answer