Print characters coming in one of the 2 strings (and not in both)

Given two strings, write a function which will print characters coming on only one of the two strings (and not both). The character may be […]

Build binary tree from ancestor matrics

You are given the Ancestor matrix of a Binary tree, write an Algorithm to construct the corresponding tree. For example, the below tree: Will have […]

Print both diagonals of a matrix

Given a matrix of order N*N, write code to print both the diagonals of that matrix. For example: the matrix and its 2 diagonals are […]

Print elements of a matrix in diagonal order

Given a square matrix of order N*N, write code to print all the elements in the order of their diagonal. For example, in the below […]

Islands in a two dimensional array

Each element in the array is connected to eight other elements (toward top, down, left and right). For example, the zero below is connected to […]

Hamming distance

Write code to calculate hamming distance between two strings. Hamming distance between two strings of equal length is equal to the total number of positions […]

Printing border nodes of Binary Tree

Given a Binary tree, Write code to print all the boundary nodes in counter clockwise order. For example, for the below binary tree, The output […]

Null pointers in a Binary tree

Given a Binary Tree with n Nodes (you may arrange these nodes any way you want to). How many NULL pointers will be there ? […]

Sorting a linked list

Write a function to sort the given unsorted linked list. Input list: 6 -> 7 -> 0 -> 1 -> 8 -> 2 -> 4 […]

Next greater power of 2

Given an unsigned int n, find the integer greater than or equal to n which is a power of 2. For example: Input Output ----- […]