# Category Archives: GFacts

## GFact 23 | (Brocard’s problem)November 12, 2016

Brocard’s problem is to find values of m and n such that n!+1 = m2 For example, a pair (4, 5) solves the above equation.… Read More »

## GFact 22 | (2^x + 1 and Prime)November 11, 2016

A number of the form 2x + 1 (where x > 0) is prime if and only if x is a power of 2, i.e.,… Read More »

## G-Fact 21 | Collatz SequenceOctober 20, 2016

Starting with any positive integer N, we define the Collatz sequence corresponding to N as the numbers formed by the following operations: N → N/2… Read More »

## G-Fact 20 (Cayley’s formula for Number of Labelled Trees)October 20, 2015

Consider below questions. How many spanning trees can be there in a complete graph with n vertices? How many labelled Trees (please note trees, not… Read More »

## G-Fact 19 (Logical and Bitwise Not Operators on Boolean)October 19, 2015

Most of the languages including C, C++, Java and Python provide the boolean type that can be either set to False or True. Consider below… Read More »

## G-Fact 18 | Finding nth Fibonacci Number using Golden RatioApril 16, 2014

We have discussed different methods to find nth Fibonacci Number.

## G-Fact 17March 2, 2013

Storage class of a variable determines whether the item has a global or local lifetime. In C, typedef is considered as a storage class like… Read More »

## fseek() vs rewind() in CMarch 7, 2011

In C, fseek() should be preferred over rewind().

## G-Fact 16December 5, 2010

Predict the output of following program.

## G-Fact 15November 24, 2010

Atomic Operation What is an atomic operation? An idea of atomic operation helps in understanding reentrancy, critical section, thread safety, synchronization primitives, etc… (we will… Read More »

## G-Fact 14November 23, 2010

In C, a structure cannot have static members, but in C++ a structure can have static members.

## G-Fact 13November 9, 2010

const Behaviour in C and C++ In C, the const qualified identifiers will have external linkage, where as in C++ it will have internal linkage.… Read More »

## G-Fact 12November 3, 2010

In C, struct keyword must be used for declaring structure variables, but it is optional in C++.

## G-Fact 11October 20, 2010

Following relationship holds in any n-ary tree in which every node has either 0 or n children. L = (n-1)*I + 1

## G-Fact 10August 12, 2010

Enumeration constants (enum values) are always of type int in C, whereas they are distinct types in C++ and may have size different from that… Read More »