Tower of Hanoi Problem

Tower of Hanoi Problem

The Tower of Hanoi is a mathematical puzzle consisting of three rods and n disks of different sizes which can slide onto any rod.

Generate power set of a given set

Given a set S, generate all subsets of it i.e., find power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.   For example, if S is the set {x, y, z}, then the subsets of S are: …

Recursive Program to Calculate Factorial of a Number

Write a recursive C/C++ and java program to calculate factorial of a given positive number.   The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. It is denoted by n!. There are n! different ways to arrange n distinct objects into a sequence.

Determine if a given string is palindrome or not

Write a program to determine if a given string is palindrome or not. A palindromic string is a string that remains the same when its characters are reversed. Like “ABCBA”, for example, it is “symmetrical”.