SlideShare a Scribd company logo
1 of 3
Download to read offline
Create two linked lists each having eight nodes…..the first list has a pointer called UNO to the
first node and the second list has a pointer called DUO to the first node. The lists are to be sorted
as you create them. The data in the lists will consist of a last name and age (e.g. Pinto 39)..now
don’t laugh!!! Print out each sorted list after you create them…..then delete all nodes from the
FIRST list whose age is under 40…and delete all nodes from the second list whose age is over
50. Print out both Finally..merge the REMAINING nodes from both lists into one list..headed by
first. Print out the final list.
Solution
#include
#include
#include
using namespace std;
void getdata(string& lastname,Int&age);
const int nil = 0;
class node_type
{
public:
string lname;
Int lage;
node_type *next;
};
void main()
{
node_type *uno, *duo, *p, *r, *newnode, *newnode2;
int i;
int age_value;
string lastname;
uno = new node_type;
p = uno;
getdata(lastname,age_value);
(*uno).lname = lastname;
(*uno).lage = age_value;
(*uno).next = nil;
duo = new node_type;
r = duo;
(*duo).lname = lastname;
(*duo).lage = age_value;
(*duo).next = nil;
for (i=0; i<=8;++i)
{
getdata(lastname,age_value);
newnode = new node_type;
newnode2 = new node_type;
(*newnode).lname = lastname;
(*newnode).lage = age_value;
(*newnode).next = nil;
(*newnode2).name = lastname;
(*newnode2).lage = age_value;
(*newnode2).next = nil;
(*p).next = newnode;
(*r).next = newnode2;
p = newnode;
r = newnode2;
}
}
void getdata(string& lastname,float& age_value)
{
cout << "Enter last name  " ;
cin >> lastname;
cout << lastname << " ";
cout << "Enter age  " ;
cin >> age_value;
cout << age_value << " ";
}
int sort[5];
int temp,i,j;
clrscr();
printf("Enter list of array: ");
for(i=0;i<5;i++){
scanf("%d",&sort[i]);
}
Now for sorting of the linked lists
/* Sorting for loop */
for(i=0;i<3;i++){
for(j=0;j<3;j++){
if(sort[i] > sort[j]){
temp=sort[j];
sort[j]=sort[i];
sort[i]=temp;
}
}
/* end of sorting */
for(i=0;i<5;i++){
printf("%d",&sort[i]);
}
For merging the linked
{
for(temp1 = uno; temp1->next!=NULL; temp1 = temp1->next);
if ((*temp1).next = NULL)
{
(*temp1).next = duo;
}
}
That should leave temp1 pointing to the last node. Then assign
temp1->next = duo;

More Related Content

Similar to Create two linked lists each having eight nodes…..the first list has.pdf

Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfrohit219406
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdffeelinggift
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdffortmdu
 
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfAssignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfformicreation
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptxchin463670
 
C program to insert a node in doubly linked list
C program to insert a node in doubly linked listC program to insert a node in doubly linked list
C program to insert a node in doubly linked listSourav Gayen
 
#include iostream using namespace std; const int nil = 0; cl.docx
#include iostream using namespace std; const int nil = 0; cl.docx#include iostream using namespace std; const int nil = 0; cl.docx
#include iostream using namespace std; const int nil = 0; cl.docxajoy21
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfarjunstores123
 
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdfWrite the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdffathimalinks
 
Write java program using linked list to get integer from user and.docx
 Write java program using linked list to get integer from user and.docx Write java program using linked list to get integer from user and.docx
Write java program using linked list to get integer from user and.docxajoy21
 
Program to insert in a sorted list #includestdio.h#include.pdf
 Program to insert in a sorted list #includestdio.h#include.pdf Program to insert in a sorted list #includestdio.h#include.pdf
Program to insert in a sorted list #includestdio.h#include.pdfsudhirchourasia86
 

Similar to Create two linked lists each having eight nodes…..the first list has.pdf (20)

Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdf
 
DSA(1).pptx
DSA(1).pptxDSA(1).pptx
DSA(1).pptx
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
 
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfAssignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
 
Unit7 C
Unit7 CUnit7 C
Unit7 C
 
C Homework Help
C Homework HelpC Homework Help
C Homework Help
 
C Exam Help
C Exam Help C Exam Help
C Exam Help
 
17 linkedlist (1)
17 linkedlist (1)17 linkedlist (1)
17 linkedlist (1)
 
Ll.pptx
Ll.pptxLl.pptx
Ll.pptx
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
C program to insert a node in doubly linked list
C program to insert a node in doubly linked listC program to insert a node in doubly linked list
C program to insert a node in doubly linked list
 
linked-list.ppt
linked-list.pptlinked-list.ppt
linked-list.ppt
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 
#include iostream using namespace std; const int nil = 0; cl.docx
#include iostream using namespace std; const int nil = 0; cl.docx#include iostream using namespace std; const int nil = 0; cl.docx
#include iostream using namespace std; const int nil = 0; cl.docx
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdf
 
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdfWrite the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
Write the following using javaGiven a class ‘Node’ and ‘NodeList’,.pdf
 
Write java program using linked list to get integer from user and.docx
 Write java program using linked list to get integer from user and.docx Write java program using linked list to get integer from user and.docx
Write java program using linked list to get integer from user and.docx
 
Program to insert in a sorted list #includestdio.h#include.pdf
 Program to insert in a sorted list #includestdio.h#include.pdf Program to insert in a sorted list #includestdio.h#include.pdf
Program to insert in a sorted list #includestdio.h#include.pdf
 

More from boothlynntur11512

Lean methodology as it is practiced today can be traced back to Mot.pdf
Lean methodology as it is practiced today can be traced back to  Mot.pdfLean methodology as it is practiced today can be traced back to  Mot.pdf
Lean methodology as it is practiced today can be traced back to Mot.pdfboothlynntur11512
 
is about coping with complexity andis about coping with c.pdf
is about coping with complexity andis about coping with c.pdfis about coping with complexity andis about coping with c.pdf
is about coping with complexity andis about coping with c.pdfboothlynntur11512
 
In C program, how to write two short programs one which hides a sho.pdf
In C program, how to write two short programs one which hides a sho.pdfIn C program, how to write two short programs one which hides a sho.pdf
In C program, how to write two short programs one which hides a sho.pdfboothlynntur11512
 
How important is cloud for GraybarSolution You may have.pdf
How important is cloud for GraybarSolution You may have.pdfHow important is cloud for GraybarSolution You may have.pdf
How important is cloud for GraybarSolution You may have.pdfboothlynntur11512
 
give me a list of positive risk factors for a charitySolutiont.pdf
give me a list of positive risk factors for a charitySolutiont.pdfgive me a list of positive risk factors for a charitySolutiont.pdf
give me a list of positive risk factors for a charitySolutiont.pdfboothlynntur11512
 
explain in details, auditing and its importanceSolutionANSWER.pdf
explain in details, auditing and its importanceSolutionANSWER.pdfexplain in details, auditing and its importanceSolutionANSWER.pdf
explain in details, auditing and its importanceSolutionANSWER.pdfboothlynntur11512
 
Discuss the differences between attributes and characteristics of sy.pdf
Discuss the differences between attributes and characteristics of sy.pdfDiscuss the differences between attributes and characteristics of sy.pdf
Discuss the differences between attributes and characteristics of sy.pdfboothlynntur11512
 
Define the terminology (10 words) common to the immune system and th.pdf
Define the terminology (10 words) common to the immune system and th.pdfDefine the terminology (10 words) common to the immune system and th.pdf
Define the terminology (10 words) common to the immune system and th.pdfboothlynntur11512
 
Describe five robot application areas for vision systems. (Select fiv.pdf
Describe five robot application areas for vision systems. (Select fiv.pdfDescribe five robot application areas for vision systems. (Select fiv.pdf
Describe five robot application areas for vision systems. (Select fiv.pdfboothlynntur11512
 
Cousin Vinnie is a shareholder and an employee in the family busines.pdf
Cousin Vinnie is a shareholder and an employee in the family busines.pdfCousin Vinnie is a shareholder and an employee in the family busines.pdf
Cousin Vinnie is a shareholder and an employee in the family busines.pdfboothlynntur11512
 
Chrome File Edit View History Bookmarks People Window He.pdf
Chrome File Edit View History Bookmarks People Window He.pdfChrome File Edit View History Bookmarks People Window He.pdf
Chrome File Edit View History Bookmarks People Window He.pdfboothlynntur11512
 
Chapter 12 Information Systems, Read this book Computer Science Illu.pdf
Chapter 12 Information Systems, Read this book Computer Science Illu.pdfChapter 12 Information Systems, Read this book Computer Science Illu.pdf
Chapter 12 Information Systems, Read this book Computer Science Illu.pdfboothlynntur11512
 
×y Connect nect Securehttpsnewcon connect.html 11.pdf
×y Connect nect Securehttpsnewcon connect.html 11.pdf×y Connect nect Securehttpsnewcon connect.html 11.pdf
×y Connect nect Securehttpsnewcon connect.html 11.pdfboothlynntur11512
 
You are instructing a class of high school students on different wir.pdf
You are instructing a class of high school students on different wir.pdfYou are instructing a class of high school students on different wir.pdf
You are instructing a class of high school students on different wir.pdfboothlynntur11512
 
Write a Java program that creates a drawing area of appropriate size.pdf
Write a Java program that creates a drawing area of appropriate size.pdfWrite a Java program that creates a drawing area of appropriate size.pdf
Write a Java program that creates a drawing area of appropriate size.pdfboothlynntur11512
 
Why is it that bacterial ribosomes can begin translation before mRNA .pdf
Why is it that bacterial ribosomes can begin translation before mRNA .pdfWhy is it that bacterial ribosomes can begin translation before mRNA .pdf
Why is it that bacterial ribosomes can begin translation before mRNA .pdfboothlynntur11512
 
Which of the statements below is FALSE 1 Common stocks ownership c.pdf
Which of the statements below is FALSE 1 Common stocks ownership c.pdfWhich of the statements below is FALSE 1 Common stocks ownership c.pdf
Which of the statements below is FALSE 1 Common stocks ownership c.pdfboothlynntur11512
 
Which of the following is NOT part of the information about foreign o.pdf
Which of the following is NOT part of the information about foreign o.pdfWhich of the following is NOT part of the information about foreign o.pdf
Which of the following is NOT part of the information about foreign o.pdfboothlynntur11512
 
What is the yield curve Why is the yield curve considered a leading.pdf
What is the yield curve Why is the yield curve considered a leading.pdfWhat is the yield curve Why is the yield curve considered a leading.pdf
What is the yield curve Why is the yield curve considered a leading.pdfboothlynntur11512
 
This is Java programing. Modify the balls.java program so that all t.pdf
This is Java programing. Modify the balls.java program so that all t.pdfThis is Java programing. Modify the balls.java program so that all t.pdf
This is Java programing. Modify the balls.java program so that all t.pdfboothlynntur11512
 

More from boothlynntur11512 (20)

Lean methodology as it is practiced today can be traced back to Mot.pdf
Lean methodology as it is practiced today can be traced back to  Mot.pdfLean methodology as it is practiced today can be traced back to  Mot.pdf
Lean methodology as it is practiced today can be traced back to Mot.pdf
 
is about coping with complexity andis about coping with c.pdf
is about coping with complexity andis about coping with c.pdfis about coping with complexity andis about coping with c.pdf
is about coping with complexity andis about coping with c.pdf
 
In C program, how to write two short programs one which hides a sho.pdf
In C program, how to write two short programs one which hides a sho.pdfIn C program, how to write two short programs one which hides a sho.pdf
In C program, how to write two short programs one which hides a sho.pdf
 
How important is cloud for GraybarSolution You may have.pdf
How important is cloud for GraybarSolution You may have.pdfHow important is cloud for GraybarSolution You may have.pdf
How important is cloud for GraybarSolution You may have.pdf
 
give me a list of positive risk factors for a charitySolutiont.pdf
give me a list of positive risk factors for a charitySolutiont.pdfgive me a list of positive risk factors for a charitySolutiont.pdf
give me a list of positive risk factors for a charitySolutiont.pdf
 
explain in details, auditing and its importanceSolutionANSWER.pdf
explain in details, auditing and its importanceSolutionANSWER.pdfexplain in details, auditing and its importanceSolutionANSWER.pdf
explain in details, auditing and its importanceSolutionANSWER.pdf
 
Discuss the differences between attributes and characteristics of sy.pdf
Discuss the differences between attributes and characteristics of sy.pdfDiscuss the differences between attributes and characteristics of sy.pdf
Discuss the differences between attributes and characteristics of sy.pdf
 
Define the terminology (10 words) common to the immune system and th.pdf
Define the terminology (10 words) common to the immune system and th.pdfDefine the terminology (10 words) common to the immune system and th.pdf
Define the terminology (10 words) common to the immune system and th.pdf
 
Describe five robot application areas for vision systems. (Select fiv.pdf
Describe five robot application areas for vision systems. (Select fiv.pdfDescribe five robot application areas for vision systems. (Select fiv.pdf
Describe five robot application areas for vision systems. (Select fiv.pdf
 
Cousin Vinnie is a shareholder and an employee in the family busines.pdf
Cousin Vinnie is a shareholder and an employee in the family busines.pdfCousin Vinnie is a shareholder and an employee in the family busines.pdf
Cousin Vinnie is a shareholder and an employee in the family busines.pdf
 
Chrome File Edit View History Bookmarks People Window He.pdf
Chrome File Edit View History Bookmarks People Window He.pdfChrome File Edit View History Bookmarks People Window He.pdf
Chrome File Edit View History Bookmarks People Window He.pdf
 
Chapter 12 Information Systems, Read this book Computer Science Illu.pdf
Chapter 12 Information Systems, Read this book Computer Science Illu.pdfChapter 12 Information Systems, Read this book Computer Science Illu.pdf
Chapter 12 Information Systems, Read this book Computer Science Illu.pdf
 
×y Connect nect Securehttpsnewcon connect.html 11.pdf
×y Connect nect Securehttpsnewcon connect.html 11.pdf×y Connect nect Securehttpsnewcon connect.html 11.pdf
×y Connect nect Securehttpsnewcon connect.html 11.pdf
 
You are instructing a class of high school students on different wir.pdf
You are instructing a class of high school students on different wir.pdfYou are instructing a class of high school students on different wir.pdf
You are instructing a class of high school students on different wir.pdf
 
Write a Java program that creates a drawing area of appropriate size.pdf
Write a Java program that creates a drawing area of appropriate size.pdfWrite a Java program that creates a drawing area of appropriate size.pdf
Write a Java program that creates a drawing area of appropriate size.pdf
 
Why is it that bacterial ribosomes can begin translation before mRNA .pdf
Why is it that bacterial ribosomes can begin translation before mRNA .pdfWhy is it that bacterial ribosomes can begin translation before mRNA .pdf
Why is it that bacterial ribosomes can begin translation before mRNA .pdf
 
Which of the statements below is FALSE 1 Common stocks ownership c.pdf
Which of the statements below is FALSE 1 Common stocks ownership c.pdfWhich of the statements below is FALSE 1 Common stocks ownership c.pdf
Which of the statements below is FALSE 1 Common stocks ownership c.pdf
 
Which of the following is NOT part of the information about foreign o.pdf
Which of the following is NOT part of the information about foreign o.pdfWhich of the following is NOT part of the information about foreign o.pdf
Which of the following is NOT part of the information about foreign o.pdf
 
What is the yield curve Why is the yield curve considered a leading.pdf
What is the yield curve Why is the yield curve considered a leading.pdfWhat is the yield curve Why is the yield curve considered a leading.pdf
What is the yield curve Why is the yield curve considered a leading.pdf
 
This is Java programing. Modify the balls.java program so that all t.pdf
This is Java programing. Modify the balls.java program so that all t.pdfThis is Java programing. Modify the balls.java program so that all t.pdf
This is Java programing. Modify the balls.java program so that all t.pdf
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 

Recently uploaded (20)

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 

Create two linked lists each having eight nodes…..the first list has.pdf

  • 1. Create two linked lists each having eight nodes…..the first list has a pointer called UNO to the first node and the second list has a pointer called DUO to the first node. The lists are to be sorted as you create them. The data in the lists will consist of a last name and age (e.g. Pinto 39)..now don’t laugh!!! Print out each sorted list after you create them…..then delete all nodes from the FIRST list whose age is under 40…and delete all nodes from the second list whose age is over 50. Print out both Finally..merge the REMAINING nodes from both lists into one list..headed by first. Print out the final list. Solution #include #include #include using namespace std; void getdata(string& lastname,Int&age); const int nil = 0; class node_type { public: string lname; Int lage; node_type *next; }; void main() { node_type *uno, *duo, *p, *r, *newnode, *newnode2; int i; int age_value; string lastname; uno = new node_type; p = uno; getdata(lastname,age_value); (*uno).lname = lastname; (*uno).lage = age_value; (*uno).next = nil;
  • 2. duo = new node_type; r = duo; (*duo).lname = lastname; (*duo).lage = age_value; (*duo).next = nil; for (i=0; i<=8;++i) { getdata(lastname,age_value); newnode = new node_type; newnode2 = new node_type; (*newnode).lname = lastname; (*newnode).lage = age_value; (*newnode).next = nil; (*newnode2).name = lastname; (*newnode2).lage = age_value; (*newnode2).next = nil; (*p).next = newnode; (*r).next = newnode2; p = newnode; r = newnode2; } } void getdata(string& lastname,float& age_value) { cout << "Enter last name " ; cin >> lastname; cout << lastname << " "; cout << "Enter age " ; cin >> age_value; cout << age_value << " "; } int sort[5]; int temp,i,j; clrscr(); printf("Enter list of array: "); for(i=0;i<5;i++){
  • 3. scanf("%d",&sort[i]); } Now for sorting of the linked lists /* Sorting for loop */ for(i=0;i<3;i++){ for(j=0;j<3;j++){ if(sort[i] > sort[j]){ temp=sort[j]; sort[j]=sort[i]; sort[i]=temp; } } /* end of sorting */ for(i=0;i<5;i++){ printf("%d",&sort[i]); } For merging the linked { for(temp1 = uno; temp1->next!=NULL; temp1 = temp1->next); if ((*temp1).next = NULL) { (*temp1).next = duo; } } That should leave temp1 pointing to the last node. Then assign temp1->next = duo;