recategorized by
882 views
0 votes
0 votes

 

recategorized by

2 Answers

0 votes
0 votes
inserting new node  1st check node  rear node -->next is  front

it will take o(n)
0 votes
0 votes

Algorithm: we will add the new node in the second position, then swap the value of the first and second node.

Code:

Let k is a pointer to the new node which we going to insert. k->next = head->next., head->next = k. now swap(k->data, head->data).

{code for swap : temp = head->data; head->data = k->data; k->data =temp;}

Time complexity: O(1)

Related questions

3 votes
3 votes
1 answer
2
hacker16 asked Nov 14, 2017
21,193 views
In circular singly linked list, insertion of node requires modification of how many pointers?1 pointers2 pointers3 pointers 4 pointers
0 votes
0 votes
2 answers
3
Mr_22B asked Dec 10, 2017
2,289 views
What is the time complexity to insert a new Node in a singly circular linked list at Starting ? (Number of nodes in list = N)A. O(1)B. O(N)