How do you implement a doubly linked list by using singly linked list?

1 answer

Answer

1053543

2026-08-17 14:40

+ Follow

Add another pointer to the nodes for the previous node:

struct node {

struct node *next;

struct node *previous;

void *data;

};

typedef struct node node;

Then change the logic for insertion and removal to make sure you set the previous pointer as well as the next one.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.