The diameter of a tree (sometimes called the width) is the number of nodes on the longest path between two leaves in the tree.
Consider the below program. The code looks simple, it reads string from standard input and prints the entered string, but it suffers from Buffer Overflow… Read More »
The problem is opposite of this post. We are given a stack data structure with push and pop operations, the task is to implement a… Read More »
Asked by Kapil Predict the output of below program.
By making use of recursion, we can multiply two integers with the given constraints. To multiply x and y, recursively add x y times. Time… Read More »
Following questions have been asked in GATE CS 2006 exam.
C allows a void* pointer to be assigned to any pointer type without a cast, whereas C++ does not; this idiom appears often in C… Read More »
Following questions have been asked in GATE CS 2009 exam.
Let us consider the below program.
Consider the below program.
In C, a string can be referred either using a character pointer or as a character array.
Difficulty Level: Rookie Question 1 Predict the output of below program.
Question: Write an efficient program for printing k largest elements in an array. Elements in array can be in any order.
You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array.… Read More »
The name malloc and calloc() are library functions that allocate memory dynamically. It means that memory is allocated during runtime(execution of the program) from heap… Read More »