Sunidhi Bansal has Published 1101 Articles

Print Leaf Nodes at a given Level in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:35:39

776 Views

The task involves printing leaf nodes of a binary tree at given level k which is specified by the user.Leaf nodes are the end nodes whose left and right pointer is NULL which means that particular node is not a parent node.ExampleInput : 11 22 33 66 44 88 77 ... Read More

Print Left View of a Binary Tree in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:33:00

369 Views

The task is to print the left nodes of a given binary tree. Firstly user will insert data hence generating binary tree and than print left view of the tree so formed.Every node can have at most 2 child so here the program must traverse only the left pointer associated ... Read More

Print modified array after multiple array range increment operations in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:25:46

91 Views

Given an array arr[m] with m number of integers and n, which is the value to be added in an array and r queries are given with some start and end. For each query we have to add value n from the start till the end of the limit in ... Read More

Print lower triangular matrix pattern from given array in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:19:21

2K+ Views

Given with the matrix of n x n the task is to print that matrix of n x n in lower triangular pattern.Lower triangular matrix is a matrix which has elements below the principle diagonal including the principle diagonal elements and rest elements as zero.Let’s understand this with help of ... Read More

Print the matrix diagonally downwards in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:08:58

328 Views

Given with an array of size n x n and the task is to print the matrix elements of integer type diagonally downwards.Diagonally downwards means printing the array of any size of n x n in diagonally moving downward like in the figure given below −Firstly it will print 1 ... Read More

Print the arranged positions of characters to make palindrome in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:59:41

156 Views

You are provided with a string str with some length n. Print the position of every element of the string so it can form a palindrome, else print a message “No palindrome” on screen.What is palindrome?Palindrome is a word, sequence of characters which reads same from the reverse or backward ... Read More

Print steps to make a number in form of 2^X – 1 in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:49:02

89 Views

Given a number n, we have to print the steps to make the number as in form of 2^X-1 by using Xor operation.We should XOR the number with any 2^M-1, where M is chosen by you, at odd step. At even step increment the number by 1Keep performing the step until ... Read More

Print the lexicographically smallest DFS of the graph starting from 1 in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:36:26

219 Views

We will be given a connected graph with N vertices and M edges. So we have to print the lexicographically smallest DFS of the graph starting from 1.Vertices should be numbered from 1 to NExampleInput: N = 5 M =5    edge(1, 4, arr)    edge(3, 4, arr)    edge(5, ... Read More

Print the lexicographically smallest BFS of the graph starting from 1 in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:28:17

377 Views

We will be given a connected graph with N vertices M edges. So we have to print the lexicographically smallest BFS of the graph starting from 1.Lexicographically means in order starting from the given point till the end point is found.Vertices should be numbered from 1 to NExampleInput: N = ... Read More

Print string of odd length in ‘X’ format in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:20:47

728 Views

Given with a string program must print the string in ‘X’ format. For reference, see the image given below.Here, one variable can be used to print from left right(“i”) and other variable can used to print from right to left(“j”) and we can take other variable k which is used ... Read More

Advertisements