Q1.Implement a list library (doublylist.h) for a doubly linked list of integers
with the create, display operations. Write a menu driven program to call
these operations.
Welcome to the forums, @MaisaraSayyed!
It seems that this post is asking for answers to a school assignment. It is against Replit Ask policy for community members to request or post complete answers to homework-like questions. On the other hand, the community can assist you in working through and understanding the core fundamentals of computer programming to help you figure out your question by yourself, though.
I assume this would be in C++ or C given ‘doublylist.h’. To make a doubly linked list, you will probably first want a structure for each element, so you should consider what each element needs to contain: some data, a link to the next list item and a link to the previous item. Now to link to other data you’re going to need to use pointers. A starting point is creating this data structure for each item (I would recommend using a struct
, which is perfect for this case), .
Then, to create the list itself, you can use a class (or appropriate C structure) to store the first item, and by following the pointers you can traverse the list and add or remove elements (by changing the pointers).
I don’t think I can give any code examples without giving too much away, but I hope this helps.