Tuesday, May 25, 2010

Source code For Stack implementation using linked list in C++

Stack using Linked list

#include "process.h"
#include "iostream.h"
struct node
{
int info;
node *next;
};

Sunday, November 29, 2009

Source code for Stack using Array method

#include “iostream.h”
#include “process.h”
class stack
{
private : int *s, sp,max;
public :
void push (); // to push item into stack
void pop ( ); // to delete an item
void display ( ); // to display the contents of stack
stack (int); // constructor
int isfull();
int isempty();
};

Tuesday, August 19, 2008

Stack ( ADT ) Data Structure

* Stack is an Abstract data structure (ADT) works on the principle Last In First Out (LIFO)
* The last element add to the stack is the first element to be delete.
* Insertion and deletion can be takes place at one end called TOP.
* It looks like one side closed tube.

Thursday, December 6, 2007

Double Linked List

Double Linked list is a fundamental data structure used in computer programming. It consists of a sequence of nodes connected by two pointers in both directions. Each node is having three parts the first part contains the address of previous node and second part contains data and third part contains address of next node. The first and third part is called address fields and the second part is data field.

Single Linked List

Single Linked list is a linear data structure. It is used as a fundamental data structure in computer programming. It contains a collection of nodes which are connected by only one pointer in one direction. Each node is having two parts the first part contains the data and second part contains the address of the next node. The first part is called data field or information field and the second part is called as link field or next address field.
The graphical representation of linked list is

Hear the pointer start always points to the first node of a list and the end node is represented by special value called NULL.

Linked Lists

Linked list: -
Linked list is a linear data structure that works on a principle Random in Random out (RIRO). Linked list can be defined as Collection of logically adjacent nodes in which logical adjacency is maintained by pointers.
Ex: The days of the week (Sun, Mon, Tue, Wed, Thu, Fri, Sat)
Linked lists can be represented in memory by two ways they are
· Using array method 2. Using pointer method

Circular Queue Data Structure



In a standard queue data structure re-buffering problem occurs for each dequeue operation. To solve this problem by joining the front and rear ends of a queue to make the queue as a circular queue
Circular queue is a linear data structure. It follows FIFO principle.
  • In circular queue the last node is connected back to the first node to make a circle.
  • Circular linked list fallow the First In First Out principle
  • Elements are added at the rear end and the elements are deleted at front end of the queue
  • Both the front and the rear pointers points to the beginning of the array.
  • It is also called as “Ring buffer”.
  • Items can inserted and deleted from a queue in O(1) time.

 
^ Scroll to Top