Browsing the topic Misc
Explain the functionality of below recursive functions.
Read More »Explain the functionality of following functions.
Read More »Explain the functionality of following functions.
Read More »You can win three kinds of basketball points, 1 point, 2 points, and 3 points. Given a total score n, print out all the combination to compose n.
Read More »You are not allowed to use loop constructs like while, for..etc, and you can only use the following ADT functions on Stack S:
isEmpty(S)
push(S)
pop(S)
Given an expression string exp, write a program to examine whether the pairs and the orders of “{“,”}”,”(“,”)”,”[","]” are correct in exp.
Read More »A queue can be implemented using two stacks. Let queue to be implemented be q and stacks used to implement q be stack1 and stack2. q can be implemented in two ways:
Read More »Multiply two integers without using multiplication, division and bitwise operators, and no loops
3 Comments | Filed under MiscAsked by Kapil
By making use of recursion, we can multiply two integers with the given constraints.
Asked by Snehal
Read More »Asked by Anshya.
Below are the different ways to add base 14 numbers.
Lucky numbers are subset of integers. Rather than going into much theory, let us see the process of arriving at lucky numbers,
Read More »Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence
1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, …
shows the first 11 ugly numbers. By convention, 1 is included.
Write a program to find and print the 150′th ugly number.
What is a Fibonacci number?
In mathematics, the Fibonacci numbers are the following sequence of numbers:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ..
The first two Fibonacci numbers are 0 and 1, and each remaining number is the sum of the previous two:
0 + [...]
The eight queens problem is the problem of placing eight queens on an 8×8 chessboard such that none of them attack one another (no two are in the same row, column, or diagonal). More generally, the n queens problem places n queens on an n×n chessboard.
There are different solutions for the problem.
You can find [...]
Power Set Power set P(S) of a set S is the set of all subsets of S. For example S = {a, b, c} then P(s) = {{}, {a}, {b}, {c}, {a,b}, {a, c}, {b, c}, {a, b, c}}.
If S has n elements in it then P(s) will have 2^n elements
ITERATIVE WAY
Read More »Below solution divides the problem into subproblems of size y/2 and call the subproblems recursively.
Read More »
