All Easy Articles

## Search in a row wise and column wise sorted matrix 2.6

Given an n x n matrix and a number x, find the position of x in the matrix if it is present in it. Otherwise,… Read More »

## fseek() vs rewind() in C 2.5

In C, fseek() should be preferred over rewind(). Note the following text C99 standard: The rewind function sets the file position indicator for the stream… Read More »

## Python Program for n-th Fibonacci number 2.5

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation Fn = Fn-1 + Fn-2 with seed values F0 =… Read More »

## Python Program for Fibonacci numbers 2

The Fibonacci numbers are the numbers in the following integer sequence.0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..In mathematical… Read More »

## Applications of Minimum Spanning Tree Problem 2.2

Minimum Spanning Tree (MST) problem: Given connected graph G with positive edge weights, find a min weight set of edges that connects all of the… Read More »

## Print BST keys in the given range 2.3

Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Print all the keys of the… Read More »

## Lower bound for comparison based sorting algorithms 2.4

The problem of sorting can be viewed as following. Input: A sequence of n numbers <a1, a2, . . . , an>. Output: A permutation… Read More »

## Print Ancestors of a given node in Binary Tree 2.5

Given a Binary Tree and a key, write a function that prints all the ancestors of the key in the given binary tree. For example,… Read More »

## Sorted insert for circular linked list 2.2

Difficulty Level: Rookie Write a C function to insert a new value in a sorted Circular Linked List (CLL). For example, if the input CLL… Read More »

## Program to compute Log n 2.3

Write a one line C function that calculates and returns . For example, if n = 64, then your function should return 6, and if… Read More »

## OOD Principles | SOLID 2.3

Object Oriented Programming paradigm deals with centralizing data and associated behaviours in a single entity. The entities will communicate by message passing. The high level… Read More »

## C++ default constructor | Built-in types 2.6

Predict the output of following program? filter_none edit close play_arrow link brightness_4 code #include <iostream> using namespace std;    int main() {       cout <<… Read More »

## Functions that cannot be overloaded in C++ 2.3

In C++, following function declarations cannot be overloaded. 1) Function declarations that differ only in the return type. For example, the following program fails in… Read More »

## C Language | Set 8 2.4

Following questions have been asked in GATE CS 2011 exam. 1) What does the following fragment of C-program print? filter_none edit close play_arrow link brightness_4… Read More »

## return statement vs exit() in main() 2.9

In C++, what is the difference between exit(0) and return 0 ? When exit(0) is used to exit from program, destructors for locally scoped non-static… Read More »

## Inorder Successor in Binary Search Tree 2.8

In Binary Tree, Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the… Read More »

## Turn an image by 90 degree 2

Given an image, how will you turn it by 90 degrees? A vague question. Minimize the browser and try your solution before going further. An image can… Read More »

## Which sorting algorithm makes minimum number of memory writes? 2.3

Minimizing the number of writes is useful when making writes to some huge data set is very expensive, such as with EEPROMs or Flash memory,… Read More »

## Static blocks in Java 2.1

Unlike C++, Java supports a special block, called static block (also called static clause) which can be used for static initializations of a class. This… Read More »

## Applications of Heap Data Structure 2.1

Heap Data Structure is generally taught with Heapsort. Heapsort algorithm has limited uses because Quicksort is better in practice. Nevertheless, the Heap data structure itself… Read More »