Stack making use of the linked list, Data Structure & Algorithms

Q. Implement a stack making use of the linked list. Show the PUSH and POP operations both.


Stack implemantation using linked list

# include

# include

struct link


int info ;

struct link *next;

}   *start;

struct link * push (struct link * rec)


struct link *new_rec;

printf ("\n Input the new value for next location of the stack:") ;

new_rec = (struct link *) malloc (size of

(struct link)) ;

scanf ("%d", &new_rec->info) ;

new_rec->next = rec;

rec = new_rec;

return (rec);


struct link * pop (struct link * rec)


struct link * temp ;

if (rec == NULL)





printf ('\n Stack is empty") ;

temp = rec; rec= temp->next;

printf("the popped element %d", temp->.info);

free(temp) ;



Posted Date: 7/13/2012 2:43:24 AM | Location : United States

Related Discussions:- Stack making use of the linked list, Assignment Help, Ask Question on Stack making use of the linked list, Get Answer, Expert's Help, Stack making use of the linked list Discussions

Write discussion on Stack making use of the linked list
Your posts are moderated
Related Questions
hello, i need help in data mining assignment using sas em and crisp-dm

how to implement prims algorithm dynamically

Z-Buffer Algorithm Also known as the Depth-Buffer algorithm, this image-space method simply selects for  display the polygon or portion of a polygon that is nearest to the view

What is A Container Taxonomy It's useful to place containers in a taxonomy to help understand their relationships to one another and as a basis for implementation using a class

Sorting Algorithm A sorting algorithm is an algorithm which puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Eff

A B-tree of minimum degree t can maximum pointers in a node T pointers in a node.

Illustrate the Visual realism applications a)   Robot Simulations : Visualization of movement of their links and joints  and end effector movement etc. b)  CNC programs ver

Explain about greedy technique The  greedy  method  suggests  constructing  a   solution  to  an  optimization  problem   by  a sequence of steps, every expanding a partially c

Methods of Collision Resolution 1)  Collision Resolution by separate chaining  2)  Collision Resolution by open addressing

One can change a binary tree into its mirror image by traversing it in Postorder is the only proecess whcih can convert binary tree into its mirror image.