EmbLogic's Blog

Rotating a single linked list by k-nodes in counter-clockwise direction in C language.

RCS file: rotate_linked_list.c,v
Working file: rotate_linked_list.c
head: 1.14
branch:
locks: strict
root: 1.14
access list:
symbolic names:
keyword substitution: kv
total revisions: 14;    selected revisions: 14
description:
Code to demonstrate how to rotate the single linked list counter clockwise by k-nodes.
—————————-
revision 1.14    locked by: root;
date: 2014/03/07 15:23:54;  author: root;  state: Exp;  lines: +2 -1
Status : Rotating a single linked list in the counter-clockwise direction by k-nodes where k is any number less than the total number of nodes in the linked list is implemented successfully.

Previous Issues:
1.After rotating the list by k-nodes the last node is not getting displayed because the start node is not returned and collected correctly.
2.Prototype mismatch.
All these issues are identified and fixed.
—————————-
revision 1.13
date: 2014/03/07 15:14:58;  author: root;  state: Exp;  lines: +25 -5
Implemented the rotate_list() function and fixed the errors by changing the prototype.
—————————-
revision 1.12
date: 2014/03/07 14:54:00;  author: root;  state: Exp;  lines: +12 -2
Changed the prototype of the display_nodes() function to int.A count variable is used to count the number of nodes in the linked list.
—————————-
revision 1.11
date: 2014/03/07 14:50:07;  author: root;  state: Exp;  lines: +1 -0
Gave prototype of the rotate_list() function.
—————————-
revision 1.10
date: 2014/03/07 14:35:45;  author: root;  state: Exp;  lines: +10 -0
Status : display_nodes() function is working fine.
Added \n to make the output of the display_nodes() function more readable.
—————————-
revision 1.9
date: 2014/03/07 14:30:05;  author: root;  state: Exp;  lines: +7 -0
Gave prototype of the display_nodes() function.Before calling the display_nodes() function a check is made to ensure whether linked list already exists or not.
Implementing the display_nodes() function…….
—————————-
revision 1.8
date: 2014/03/07 14:25:56;  author: root;  state: Exp;  lines: +1 -0
Logical error fixed.
Issue:A pointer variable of type struct node is not declared but used.
—————————-
revision 1.7
date: 2014/03/07 14:24:15;  author: root;  state: Exp;  lines: +25 -0
Gave prototype for insert_node() function.Also gave the definition of the insert_node() function which will insert the node at the end of the single linked list.
—————————-
revision 1.6
date: 2014/03/07 14:16:54;  author: root;  state: Exp;  lines: +21 -2
Gave definition of the create_list() function.Declared a flag variable that on creation of a start node is set to 1 and thus it avoids to create the start node again in case the user accidently chooses the create_list option again.
—————————-
revision 1.5
date: 2014/03/07 14:12:30;  author: root;  state: Exp;  lines: +11 -0
Declared two pointer variables of type struct node.
—————————-
revision 1.4
date: 2014/03/07 14:10:12;  author: root;  state: Exp;  lines: +1 -0
Gave prototype for create_list() function.
Defining the body of the create_list() function…..
—————————-
revision 1.3
date: 2014/03/07 14:08:18;  author: root;  state: Exp;  lines: +17 -0
exit() function is used to assist in ending the program.
Also included header file:<stdlib.h> to support exit() function.
—————————-
revision 1.2
date: 2014/03/07 14:01:19;  author: root;  state: Exp;  lines: +12 -1
Created a main menu for the user to assist him/her in performing the operations on a single linked list.
—————————-
revision 1.1
date: 2014/03/07 13:29:12;  author: root;  state: Exp;
Initial revision
=============================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>