Sudhir sharma has Published 951 Articles

Print Ancestors of a given node in Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:52:43

2K+ Views

In this problem, we are given a binary tree and we have to print its ancestor of a node in a binary tree.Binary Tree is a special tree whose every node has at max two child nodes. So, every node is either a leaf node or has one or two ... Read More

Print array elements in alternatively increasing and decreasing order in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:48:44

503 Views

In this problem, we are given an array of number and we have to print the elements of the array in alternatively increasing and decreasing order while printing. The alternative order will be in such a way that 1st two elements are in increasing order and then the next three ... Read More

Print array elements that are divisible by at-least one other in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:45:45

409 Views

In this problem, we are given an array of integers and we have to print only those numbers that are divisible by at least one other element of the array.Let’s take an example to understand the concept better, Input : 3 12 16 21 Output : 12 21Explanation − ... Read More

Print array of strings in sorted order without copying one string into another in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:42:54

704 Views

In the problem to print an array of strings in sorted order without copying one string into another, we need to sort the array of string. Here the programmer cannot copy a string into another string while sorting.Let’s take an example to understand the concept better :Example −Input : {“Delhi”, “Hyderabad”, ... Read More

Print Binary Tree in 2-Dimensions in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:39:06

1K+ Views

In this problem, we are given a binary tree and we have to print it two dimensional plane.Binary Tree is a special tree whose every node has at max two child nodes. So, every node is either a leaf node or has one or two child nodes.Example, Let’s take an ... Read More

Print Binary Tree levels in sorted order in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:33:48

245 Views

In this problem, we are given a binary tree and we have to print all nodes at a level in sorted order of their values.Let’s take an example to understand the concept better, Input −Output −20 6 15 2 17 32 78To solve this problem, we need to print a sorted ... Read More

Print bitwise AND set of a number N in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:30:29

171 Views

In this problem, we have to print all the numbers from 0 to n which are Bitwise AND of a binary of n.Let’s take an example to understand the concept better.Input : N = 4. Output : 0 4 Explanation :    0 & 4 = 0    1 & ... Read More

Print BST keys in the given range in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:28:26

717 Views

In this problem, we are given two nodes of a binary search tree. And we have to print all the values in the range of k1 to k2 that occur in the tree. That is we have to print all the values that are greater than k1 and smaller than ... Read More

Print Bracket Number in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:23:18

414 Views

In this problem, we are given expression. And we have to print the bracket number sequence. Let’s look at an example to understand the problem better.Example, Input : ((()())()) Output : 1233442551Explanation − Here we have encountered 5 bracket pairs and we have printed them in a sequence of their[ ... Read More

Print calendar for a given year in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:06:07

4K+ Views

In this problem, we are given a year and we want to print the calendar for that year.The year calendar shows all days, months on every date of the month. And here we will create a program that will return the calendar of the current year.For this, we will need ... Read More

Advertisements