Write down the procedure to reverse a singly linked list. , Data Structure & Algorithms

Ans:

A procedure to reverse the singly linked list:

reverse(struct node **st)

{

struct node *p, *q, *r;

p = *st;

q = NULL;

while(p != NULL)

{

r =q;

q = p;

p = p        link;

q        link = r;

}

*st = q;

}

Posted Date: 7/11/2012 1:18:08 AM | Location : United States







Related Discussions:- Write down the procedure to reverse a singly linked list. , Assignment Help, Ask Question on Write down the procedure to reverse a singly linked list. , Get Answer, Expert's Help, Write down the procedure to reverse a singly linked list. Discussions

Write discussion on Write down the procedure to reverse a singly linked list.
Your posts are moderated
Related Questions
So far, we now have been concerned only with the representation of single stack. What happens while a data representation is required for several stacks? Let us consider an array X

Addition of new records in a Binary tree structure always occurs as leaf nodes, which are further away from the root node making their access slower. If this new record is to be ac

create aset of ten numbers.then you must divide it into two sets numbers which are set of odd numbers and set of even numbers.

B-trees are special m-ary balanced trees utilized in databases since their structure allows records to be added, deleted & retrieved with guaranteed worst case performance. A B-

Advantages of First in First out (FIFO) Costing Advantages claimed for first in first  out (FIFO)  costing method are: 1. Materials used are drawn from the cost record in

Example: (Double left rotation while a new node is added into the AVL tree (RL rotation)) Figure: Double left rotation when a new node is inserted into the AVL tree A

Explain CAM software CAD/CAM software has been recognized as an essential tool in the designing and manufacturing of a product due to its ability to depict the designs and tool

Midsquare Method :- this operates in 2 steps. In the first step the square of the key value K is taken. In the 2nd step, the hash value is obtained by deleting digits from ends of

I need a person who has a good background in using R. Studio? In adition, a person who is good in using algorithms.

Write a program that uses the radix sort to sort 1000 random digits. Print the data before and after the sort. Each sort bucket should be a linked list. At the end of the sort, the