Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Program Discussion :: Trees

Home > Programs > Trees

71 / 17

Make 3 nodes in doubly linked list and delete the 2nd node. Use pointer as ptr. Write the program for same.

Answer:

#include 
#include 
# include 
using namespace std; 
struct node
{
    struct node *prev;
    int n;
    struct node *next;
}*h,*temp,*temp1,*temp2,*temp4;
void insert1();
void insert2();
void insert3();
void del();
int count = 0;
void main()
{
    int ch;
    h = NULL;
    temp = temp1 = NULL;
    coutprev = temp;
        temp2->next = temp;
    }
}
 
/* To delete an element */
void del()
{
    int i = 1, pos;
 
    coutpos;
    temp2 = h;
 
    if ((pos < 1) || (pos >= count + 1))
    {
        coutprev;
        if (i != 1)
            temp2->prev->next = temp2->next;    /* Might not need this statement if i == 1 check */
        if (i == 1)
            h = temp2->next;
        cout

Asked In :: Wipro

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here: