## What is the purpose of a function prototype?

The Function prototype serves the following purposes – 1) It tells the return type of the data that the function will return. 2) It tells… Read More »

## Lowest Common Ancestor in a Binary Search Tree.

Given values of two values n1 and n2 in a Binary Search Tree, find the Lowest Common Ancestor (LCA). You may assume that both the… Read More »

## Given a binary tree, print out all of its root-to-leaf paths one per line.

Given the roots of a tree. print out all of its root-to-leaf paths one per line.. Algorithm: initialize: pathlen = 0, path[1000] /*1000 is some… Read More »

## Write a program to add two numbers in base 14

Asked by Anshya. Below are the different ways to add base 14 numbers. Method 1 Thanks to Raj for suggesting this method. 1. Convert both… Read More »

## How can I return multiple values from a function?

We all know that a function in C can return only one value. So how do we achieve the purpose of returning multiple values. Well,… Read More »

First of all, what is function overloading? Function overloading is a feature of a programming language that allows one to have many functions with same… Read More »

## Lucky Numbers

Lucky numbers are subset of integers. Rather than going into much theory, let us see the process of arriving at lucky numbers, Take the set of… Read More »

## Detect loop in a linked list

Given a linked list, check if the linked list has loop or not. Below diagram shows a linked list with a loop.     Recommended:… Read More »

## Python Program to Reverse a linked list

Given pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list by… Read More »

## Java Program for Reverse a linked list

Given pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list by… Read More »

## C Program for Reverse a linked list

Given pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list by… Read More »

Given pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list by… Read More »

## Write an Efficient C Program to Reverse Bits of a Number

Given an unsigned integer, reverse all bits of it and return the number with reversed bits. Input : n = 1 Output : 2147483648 On… Read More »

## If you are given two traversal sequences, can you construct the binary tree?

It depends on what traversals are given. If one of the traversal methods is Inorder then the tree can be constructed, otherwise not. Therefore, following… Read More »

## PHP Program to print all permutations of a given string

A permutation, also called an “arrangement number” or “order, ” is a rearrangement of the elements of an ordered list S into a one-to-one correspondence… Read More »