Lab 3
Lab 3
class LinkedList
{
private:
node *head;
public:
\\ member functions
};
class DoublyLinkedList {
public:
void create_list(int value); // pass the value and
create a node in DoublyLinkedList
void add_begin(int value); // insert node at beginning
void add_after(int value, int position); // insert node
after given position
void delete_element(int value); // delete particular
value node
bool search_element(int value); // search for the node
void display_dlist(); // display the DoublyLinkedList
void count(); // count the number of nodes in the
DoublyLinkedList
void reverse(); // reverse the complete list
void sortList(); // sort the list in ascending order
DoublyLinkedList ()
{
head = NULL;
}
};
Write a menu-driven driver code to ask the user to perform one of
the functions and repeat this step till the user exits.
struct node
{
int info;
struct node *next;
struct node *prev;
};
class CircularDoublyLinkedList
{
public:
void create_list(int value); // create list
void insert_begin(int value); //insert at beginning and
update the list
void insert_last(int value); // insert at last and
update the list
void insert_pos(int value , int position); // insert at
particular position and update the list
}
};
Write a menu-driven driver code to ask the user to perform one of
the functions and repeat this step till the user exits.