Question: Create a Circular Singly Linked List where you have a head node that point to the first node. Then first node points to second node.
Create a Circular Singly Linked List where you have a head node that point to the first node. Then first node points to second node. second node points to third node. third node point to FIRST node.
Here, the last node does not point to head node, it points to first node.
Use this struct below.
struct person { string name; person *knows; person(string x, person *t) { name= x; knows= t; } }; Helpful info.
First, create a "Lead" pointer as a leader of the group. Then, create three persons and make appropriate dereferencing (pointer connection) so that 1st person points 2nd; 2nd points 3rd; 3rd points 1st; Lead points 1st.
As the output of program, you need to show the name of leader, 1st, 2nd, and 3rd, such as
Leader is1st is 2nd is 3rd is
Please note that you do not create extra variables to keep person names and knows. You need to access next person using "knows" variable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
