Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Application Problems

Aneesh,Amruth,Pradeep,Ravindra

Section: Linked Lists

Try and solve these problems!

1. Write a pseudo code to reverse the elements of a linked list, given the pointer to the first
node?

2. Find the nth element from the end of the linked list, given the pointer to the first element of
the list?

3. How do you determine if there is a loop in a linked list? Write a pseudo code for the same?

4. If two linked lists are merged at a node, how do you determine the node?

5. How do you determine the middle element of the linked list? Write a code for the same
which returns the middle element of the linked list?

6. Same as question 6, but what if there is a loop in the list?

7. Given only a pointer to a node to be deleted in a singly linked list, how do you delete it?

8. Given a linked list having positive integers, divide it into two separate linked list containing
even and odd integers. Modify the same linked list?

9. Each digit of a number is stored in a node of a linked list, given two linked lists of any length,
write a program to add the lists?

Ex: 45321 is 4->5->3->2-1->NULL

9876543 is 9->8->7->6->5->4->3 -> NULL

So you have to find 45321+9876543=?

10. A string is represented using a linked list? How do you determine if it is a palindrome or not
in O(n)?

You might also like