<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>doubly linked list | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/doubly-linked-list/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 09 Jun 2012 16:51:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Program for Doubly Linked List Operations</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/program-for-doubly-linked-list-operations/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/program-for-doubly-linked-list-operations/#respond</comments>
		
		<dc:creator><![CDATA[Ansten Lobo]]></dc:creator>
		<pubDate>Sat, 09 Jun 2012 16:51:25 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[Insert]]></category>
		<category><![CDATA[Delete]]></category>
		<category><![CDATA[doubly linked list]]></category>
		<category><![CDATA[Display]]></category>
		<category><![CDATA[c lab prgrams]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=3315</guid>

					<description><![CDATA[<p>Program for Doubly Linked List Operations – Insert (Front, Before), Delete, Display Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT #include typedef struct dnode { int data; struct dnode *next,*prev; }DNODE; DNODE *InsFront(DNODE *, int); DNODE *InsBefore(DNODE *, int,int); DNODE *DelNode(DNODE *, int); void Display(DNODE *); main() { DNODE *start=NULL; /*</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/program-for-doubly-linked-list-operations/">Program for Doubly Linked List Operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Program for Doubly Linked List Operations – Insert (Front, Before), Delete, Display<br />
Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT</p>
<pre lang="C" line="1">
#include <stdlib.h>
typedef struct dnode
{
    int data;
    struct dnode *next,*prev;
}DNODE;

DNODE *InsFront(DNODE *, int);
DNODE *InsBefore(DNODE *, int,int);
DNODE *DelNode(DNODE *, int);
void Display(DNODE *);

main()
{
    DNODE *start=NULL;		 /* Main Program */
    int opn,elem,info,n,i;
    do
    {
        clrscr();
        printf("\n ### Doubly Linked List Operations ### \n\n");
        printf("\n Press 1-Creation with front Insertion");
        printf("\n       2-Insert Before a Given Node");
        printf("\n       3-Delete a Given Node");
        printf("\n       4-Display");
        printf("\n       5-Exit\n");
        printf("\n       Your option ? ");
        scanf("%d",&opn);
        switch(opn)
        {
        case 1:
            printf("\n\nHow Many Nodes ?");
            scanf("%d",&n);
            for(i=1;i<=n;i++)
            {
                printf("\nRead the Data for Node %d ?",i);
                scanf("%d",&#038;elem);
                start=InsFront(start,elem);
            }
            printf("\nDoubly Linked list with %d nodes is ready toUse!!\n",n);
            break;
        case 3: printf(" Read the Info of the Node to be deleted ? ");
            scanf("%d",&#038;info);
            start=DelNode(start,info);
            break;
        case 2: printf(" Read the Data for New node\n");
            scanf("%d",&#038;elem);
            printf(" Read the Info of the Node(to the left of which new node tobe inserted ? ");
            scanf("%d",&#038;info);
            start=InsBefore(start,elem,info);
            break;
        case 4: printf(" Doubly Linked List is \n");
            Display(start); break;
        case 5: printf("\n\n Terminating \n\n"); break;
        default: printf("\n\nInvalid Option !!! Try Again !! \n\n");
            break;
        }
        printf("\n\n\n\n  Press a Key to Continue . . . ");
        getch();
    }while(opn != 5);
}

DNODE *InsFront(DNODE *start, int elem)
{
    DNODE *temp;
    temp=(DNODE *)malloc(sizeof(DNODE));
    if( temp == NULL)
    { printf(" Out of Memory !! Overflow !!!");
    return(start);
    }
    else
    {
        temp->data=elem;
        temp->prev=NULL;
        temp->next=start;
        start->prev=temp;
        printf(" New Node has been inserted at Front Successfully !!");
        return(temp);
    }
}

DNODE *InsBefore(DNODE *start, int elem,int info)
{
    DNODE *temp,*t;
    temp=(DNODE *)malloc(sizeof(DNODE));
    if( temp == NULL)
    { printf(" Out of Memory !! Overflow !!!");
    return(start);
    }
    else
    {
        temp->data=elem;
        temp->next=NULL;
        temp->prev=NULL;

        if(start->data == info)    /* Front Insertion */
        { temp->next=start;
        start->prev=temp;
        return(temp);
        }
        else
        {
            t=start;
            while( t != NULL && t->data != info)
                t=t->next;
            if(t->data == info) /* Node found */
            {
                temp->next=t;
                temp->prev=t->prev;
                t->prev->next=temp;
                t->prev=temp;
            }
            else
                printf(" Node not found,Invalid Info !!!");
            return(start);
        }
    }
}

DNODE *DelNode(DNODE *start, int info)
{
    DNODE *t;
    if( start ==  NULL) { printf(" Underflow!!!"); return(start); }
    else
    { t=start;
    if(start->data == info)    /* Front Deletion */
    { start=start->next;
    start->prev=NULL;
    t->next=NULL;
    free(t);
    return(start);
    }
    else
    {
        while( t != NULL && t->data != info)
            t=t->next;
        if(t->data == info) /* node to be deleted  found*/
        {
            t->prev->next=t->next;
            t->next->prev=t->prev;
            t->next=t->prev=NULL;
            free(t);
        }
        else
            printf("Node not found, Invalid Info !!");
        return(start);
    }
    }
}
void Display(DNODE *start)
{ 
	DNODE *t;
	if( start == NULL) printf("Empty List\n");
	else
	{
		t=start;
		printf("Forward Traversal \n\n Start->");
		while(t)
		{
			printf("[%d]->",t->data);
			t=t->next;
		}
		printf("Null\n");
	}
}
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/program-for-doubly-linked-list-operations/">Program for Doubly Linked List Operations</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c/data-structures-c/program-for-doubly-linked-list-operations/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement the double ended queue using a double linked list</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-double-ended-queue-using-a-double-linked-list/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-double-ended-queue-using-a-double-linked-list/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Wed, 10 Mar 2010 16:55:38 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[deque]]></category>
		<category><![CDATA[double ended queue]]></category>
		<category><![CDATA[doubly linked list]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=998</guid>

					<description><![CDATA[<p>class node<br />
{<br />
public:<br />
int data;<br />
class  node *next;<br />
class node *prev;<br />
};</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-double-ended-queue-using-a-double-linked-list/">C++ program to implement the double ended queue using a double linked list</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write C++ program to implement the double ended queue ADT using a doubly linked list */</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;

class node
{
public:
int data;
class  node *next;
class node *prev;
};

class dqueue: public node
{
  node *head,*tail;
  int top1,top2;
  public:
   dqueue()
   {
   top1=0;
   top2=0;
   head=NULL;
   tail=NULL;
   }
  void push(int x){
	node *temp;
	int ch;
	if(top1+top2 >=5)
	{
	  cout <<"dqueue overflow";
	  return ;
	}
	if( top1+top2 == 0)
	  {
	    head = new node;
	    head->data=x;
	    head->next=NULL;
	    head->prev=NULL;
	    tail=head;
	    top1++;
	  }
	 else
	 {
	   cout <<" Add element 1.FIRST 2.LAST\n enter ur choice:";
	   cin >> ch;


	   if(ch==1)
	   {
	     top1++;
	     temp=new node;
	     temp->data=x;
	     temp->next=head; 
	     temp->prev=NULL;
	     head->prev=temp;
	     head=temp;
	   }
	   else
	   {
	     top2++;
	     temp=new node;
	     temp->data=x;
	     temp->next=NULL;
	     temp->prev=tail;
	     tail->next=temp;
	     tail=temp;
	   }

	 }
  }
  void pop()
  {
   int ch;
   cout <<"Delete 1.First Node 2.Last Node\n Enter ur choice:";
   cin >>ch;
   if(top1 + top2 <=0)
   {
     cout <<"\nDqueue under flow";
     return;
   }
   if(ch==1)
   {
     head=head->next;
     head->prev=NULL;
     top1--;
   }
   else
   {
     top2--;
     tail=tail->prev;
     tail->next=NULL;
   }
  }

  void display()
  {
   int ch;
   node *temp;
   cout <<"display from 1.Staring 2.Ending\n Enter ur choice";
   cin >>ch;
   if(top1+top2 <=0)
   {
     cout <<"under flow";
     return ;
   }
   if (ch==1)
   {
    temp=head;
    while(temp!=NULL)
    {
      cout << temp->data <<" ";
      temp=temp->next;
    }
   }
   else
   {
    temp=tail;
    while( temp!=NULL) 
    {
      cout <<temp->data << " ";
      temp=temp->prev;
    }
   }
    }
  };

  main()
  {
    dqueue d1;
    int ch;
    while (1){
	cout <<"1.INSERT  2.DELETE  3.DISPLAU  4.EXIT\n Enter ur choice:";
    cin >>ch; 
    switch(ch)
    {
    case 1:     cout <<"enter element";
		cin >> ch;
		d1.push(ch); break;
    case 2: d1.pop(); break;
    case 3: d1.display(); break;
    case 4: exit(1);
    }
  }}
</pre>
<p><strong>OUTPUT</strong></p>
<p>1.INSERT  2.DELETE  3.DISPLAU  4.EXIT<br />
 Enter ur choice:1<br />
enter element4</p>
<p>1.INSERT  2.DELETE  3.DISPLAU  4.EXIT<br />
 Enter ur choice:1<br />
enter element5<br />
 Add element 1.FIRST 2.LAST<br />
 enter ur choice:1</p>
<p>1.INSERT  2.DELETE  3.DISPLAU  4.EXIT<br />
 Enter ur choice:1<br />
enter element6<br />
 Add element 1.FIRST 2.LAST<br />
 enter ur choice:2</p>
<p>1.INSERT  2.DELETE  3.DISPLAU  4.EXIT</p>
<p> Enter ur choice:3<br />
display from 1.Staring 2.Ending<br />
 Enter ur choice1<br />
5 4 6 </p>
<p>1.INSERT  2.DELETE  3.DISPLAU  4.EXIT</p>
<p> Enter ur choice:2<br />
Delete 1.First Node 2.Last Node<br />
 Enter ur choice:1</p>
<p>1.INSERT  2.DELETE  3.DISPLAU  4.EXIT</p>
<p> Enter ur choice:3<br />
display from 1.Staring 2.Ending</p>
<p> Enter ur choice1<br />
4 6 </p>
<p>1.INSERT  2.DELETE  3.DISPLAU  4.EXIT<br />
Enter ur choice:4</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-double-ended-queue-using-a-double-linked-list/">C++ program to implement the double ended queue using a double linked list</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-the-double-ended-queue-using-a-double-linked-list/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
