You are on page 1of 15

Lab report 4

Doubly linked list and operations

Q1.Consider a scenario where a firm wants to maintain the data of its


employees. The data containing employee number, salary and department# are
saved in a Doubly linked list. Create following functions for the employee list.

1) InsertAtFront:     Insertion of a record at the front.


2) InsertAtEnd:        Insertion of a record at the end.
3) Insert_anywhere:                Insertion of a record at position P given by user in
the list
4) Display:                Displaying all records.
5) Search Search the position of any node based on its data
6) Delete_node : Delete node from any position

Initially a menu will be appearing where user can give a choice to perform any
function. Use SWITCH for that purpose.
Output
Question 2

Write a program to display string using linked list. Take a string of character from
user and split the string in character, and then insert each character into linked list.
Example: String = “RPI”

head R -- P - I NULL
>>>> >>>>
Output
Question 3

:write a program to Check if a linked list of numbers forms a


palindrome?
Hint:A palindrome is a string/number that mirrors itself, for example, 21312
reverse is also 21312 .
Output

You might also like