
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sunidhi Bansal has Published 1085 Articles

Sunidhi Bansal
154 Views
Given a binary tree, we have to print its leaf nodes and then we have to remove those leaf nodes and then repeat till there are no nodes left in the tree.ExampleSo the output of the problem should be −6 7 9 13 14 3 4 2 1ApproachWe have adopted ... Read More

Sunidhi Bansal
1K+ Views
Given a matrix mat[row][col] we have to print the given matrix in zig-zag fashion like in the given image below −So the output should be like −Output: 10 20 40 70 50 30 60 80 90For the above problem, we have followed a simple approach where we have to iterate ... Read More

Sunidhi Bansal
472 Views
We are given with a binary tree of distinct nodes and two nodes of the binary tree whose path in the binary tree we want to print.For Example − We want to print the path between node 140 to 211 so its output should be like −Output: 140->3->10->211The idea is ... Read More

Sunidhi Bansal
238 Views
Given the binary tree the program must find out the shortest path from the root to leaf amongst many given paths.Since we traverse the tree from left to right, so if there are multiple shortest paths from the root to leaf than the program will print the first traversed the ... Read More

Sunidhi Bansal
245 Views
Given the binary tree the program must find out the multiple paths from the root to a leaf which means all the paths should be printed but the challenge is to without using recursion.We will traverse the tree iteratively as the constraint is to do it without recursion. So to ... Read More

Sunidhi Bansal
158 Views
Given the binary tree, the program must print the nodes at odd levels of a tree and the levels of a binary tree start from 1 to n.As nothing is mentioned one of the two approaches can be implemented i.e. recursion or iteration.Since we are using a recursive approach, the ... Read More

Sunidhi Bansal
265 Views
Given the binary tree, the task is to print the level associated with every key stored in a node starting from 1 to nIn the above tree, nodes are −10 at level 1 3 and 211 at level 2 140, 162, 100 and 146 at level 3Given the key the ... Read More

Sunidhi Bansal
171 Views
Given the binary tree, the function will generate the binary values of the keys stored in the nodes and then return the number of set bits(1) in that binary equivalent.ExampleBinary tree having keys as: 10 3 211 140 162 100 and 146KeyBinary equivalentSet bits(output)101010230011221111010011514010001100316210100010310011001003146100100103Here we are using the function __builtin_popcountThe ... Read More

Sunidhi Bansal
356 Views
Given an array of nxn size, the program must print the elements of an array in a snake pattern starting from the last column that means from arr[0][n]th element without doing any changes to their original locations.ExampleInput: arr[]= 100 99 98 97 93 94 95 96 92 91 ... Read More

Sunidhi Bansal
4K+ Views
Given an array of nxn size, the program must print the elements of an array in a snake pattern without doing any changes to their original locationsExampleInput: arr[]= 100 99 98 97 93 94 95 96 92 91 90 89 85 86 87 88 Output: 100 99 ... Read More