## Write a program to Delete a Tree

To delete a tree we must traverse all the nodes of the tree and delete them one by one. So which traversal we should use… Read More »

## Write a Program to Find the Maximum Depth or Height of a Tree

Given a binary tree, find height of it. Height of empty tree is 0 and height of below tree is 3. Example Tree Recommended: Please… Read More »

## Write Code to Determine if Two Trees are Identical

Two trees are identical when they have same data and arrangement of data is also same. To identify if two trees are identical, we need… Read More »

## Write a program to Calculate Size of a tree | Recursion

Size of a tree is the number of elements present in the tree. Size of the below tree is 5. Example Tree Size() function recursively… Read More »

## Tree Traversals (Inorder, Preorder and Postorder)

Unlike linear data structures (Array, Linked List, Queues, Stacks, etc) which have only one logical way to traverse them, trees can be traversed in different… Read More »

## 8 queen problem

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… Read More »

## Change/add only one character and print ‘*’ exactly 20 times

In the below code, change/add only one character and print ‘*’ exactly 20 times. int main() { int i, n = 20; for (i =… Read More »

## Condition To Print “HelloWord”

What should be the “condition” so that the following code snippet prints both HelloWorld! if “condition” printf (“Hello”); else printf(“World”); Method 1: filter_none edit close… Read More »

## Power Set

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… Read More »

## Find the Missing Number

You are given a list of n-1 integers and these integers are in the range of 1 to n. There are no duplicates in list.… Read More »

## Implement Your Own sizeof

Here is an implementation. filter_none edit close play_arrow link brightness_4 code #define my_sizeof(type) (char *)(&type+1)-(char*)(&type) int main() {     double x;     printf(“%d”, my_sizeof(x));     getchar();     return 0;… Read More »

## PHP Program for Largest Sum Contiguous Subarray

Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Recommended: Please solve… Read More »

## C# Program for Largest Sum Contiguous Subarray

Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Recommended: Please solve… Read More »

## Python Program for Largest Sum Contiguous Subarray

Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Recommended: Please solve… Read More »

## Java Program for Largest Sum Contiguous Subarray

Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Recommended: Please solve… Read More »