## 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, …

## Sort Elements by Frequency of Occurrences

Problem Statement   In sort elements by frequency of occurrences problem, we have given an array a[]. Sort array elements in such a way that the element with the highest number of occurrences comes first. If the number of occurrences is equal then the print the number which appeared first in …

## 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 …

## 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 …

## 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 …