## Find the First and Second Smallest Elements

Problem Statement In find the first and second smallest elements problem we have given an array of integers. Find the first and second smallest integers from an array or find two smallest numbers from an array. Example Input 7, 6, 8, 10, 11, 5, 13, 99 Output First Smallest is …

## Find the Number Occurring Odd Number of Times in an Array

Problem Statement Given an array of positive integers. All numbers occur even a number of times except one number which occurs an odd number of times. We have to find the number occurring an odd number of times in an array. Example Input 1, 1, 1, 1, 2, 2, 3, …

## Find the Missing Number

Problem Statement In finding the missing number from an array of 1 to N numbers we have given an array that contains N-1 numbers. One number is missing from an array of numbers from 1 to N. We have to find the missing number. Input Format First-line containing an integer …

## Insert Node in the Sorted Linked List

Problem Statement In the “Insert Node in the Sorted Linked List” problem we have given a linked list. Insert a new node in the sorted linked list in a sorted way. After inserting a node in the sorted linked list the final linked list should be the sorted linked list. …

## Detect a loop in the Linked List

Problem Statement In the “Detect a loop in the Linked List” problem we have given a linked list. Find whether there is loop or not. If there is a loop in the linked list then some node in the linked list will be pointing to one of the previous nodes …

## Find Nth Node

Problem Statement In the “Find Nth Node” problem we have given a linked list to find the nth node. The program should print the data value in the nth node. N is the input integer index. Example 3 1 2 3 4 5 6 3 Approach Given a linked list …

## Swap Kth Node from beginning with Kth Node from End

Problem Statement In the “Swap Kth Node from beginning with Kth Node from End” problem, we have given a linked list. Swap kth node from beginning_with kth node from the end. We should not swap the values, we should swap pointers. Example 2 1 2 3 4 5 6 1 …

## Delete Last Occurrence

Problem Statement In the “Delete Last Occurrence” problem we have given a linked list. Write a program to delete the last occurrence of a given key from the linked list. The list can contain duplicates. Example 1 2 3 5 2 10 1 2 3 5 2 Approach Given a …

## Check if a Linked list of Strings form a Palindrome

Problem Statement In the “Check if a Linked list of Strings form a Palindrome” problem we have given a linked list handling string data. Write a program to check whether the data forms a palindrom or not. Example ba->c->d->ca->b 1 Explanation: In the above example we can see that the …

Translate »