ProAnswers.org

Algorithm Representation of a Stack Data Structure

algorithm Representation of a Stack Data Structure

[b]Representing stack data structure

Array representation[/b]

    
typedef struct stack{
    int SArray[MAX_SIZE];
    int top;
}stack;

[b]Linked list representation[/b]

    
typedef struct SNode{
    int data;
    struct SNode *next;
}SNode;
 
typedef struct stack{
    SNode *top;
}stack;