# Print missing and duplicate numbers in the given sequence of numbers.

Given a range of natural numbers where some numbers are repeated and some are missing in the range. Our aim is to find missing numbers and repeated numbers. Let us discuss the problem with an example. So for the input {2, 3, 3, 5, 5, 8, 2} our output should be as follows. This problemRead More »

# Auto-suggestion implementation using Trie Data Structure.

Trie data structure has many useful applications, one of the important applications of the trie is auto-suggestion when user inputs using the keyboard. Let us assume we have a dictionary that contains “APPLE”, “APE”, “GOD”, “GOOD”, “GUN”. So, when a user enters “GO” then our auto-suggestion suggests “GOD”, “GOOD” as a suggested list of words.Read More »

# Trie Data Structure

Trie data structures are useful to process and search in large character data sets. It takes only orders of word length to search a word in length file or a million words dictionary. Some examples where Trie’s use. In finding words in large files. In finding any word in the large dictionary of words. InRead More »

# An algorithm to move all zeros to rightmost in an integer array.

Given an integer array, which contains some ‘k’ zeros. We aim to move all ‘k’ zeros to the right of most of the integer array. Let us see this with an example. Algorithm Iterate through each integer in the array and take a variable “pos,” representing the end of the array at first. If theRead More »

# Find all possible combinations of decodings of a number.

Given an encoding number as explained below, we aim to print all combinations of decoding strings to that input number. The encoding number is as follows. Defining a recursion for this problem is very simple. Let us see the recursion tree for the input number. Let us now write the code for this recursion algorithm.Read More »

# Given two linked lists, both represent a number need to find its sum linked list.

As described in problem statement, we have two linked lists represents as decimal numbers. We aim to find its sum as a linked list. Let us understand this with an example. We can solve this problem in two different ways. Digit by digit sum calculation. Converting a list to the number and calculate the sumRead More »

# Swap two integers without using the third variable.

Swapping is an act of changing one integer into another. The standard way of swapping two integers is by using another temporary variable, as showing in the below code. But, our requirement is not to use a third variable (which is “temp” in the above code). To solve this, we have two different approaches. UsingRead More »

# How to find merge point of two linked lists

Let us take two linked lists which at some point merge as one list. Our goal is to find the point where the given two linked lists merging. The most optimized solution for this problem is to find the maximum length list and jump each node until both lists length becomes the same. Below isRead More »

# How to convert double to string in C/C++

Double is a C/C++ data type to represent double-precision floating-point real numbers. There are multiple ways of doing this conversion, whereas we will discuss a couple of methods of doing double to string conversion. Using stringstream stringstream is a string output stream reader which takes all the input values and writes into a string. Let’sRead More »