Sunidhi Bansal has Published 1101 Articles

Program for Celsius To Fahrenheit conversion in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Sep-2019 08:30:20

567 Views

Given with temperature ‘n’ in Celsius the challenge is to convert the given temperature to Fahrenheit and display it.ExampleInput 1-: 100.00    Output -: 212.00 Input 2-: -40    Output-: -40For converting the temperature from Celsius to Fahrenheit there is a formula which is given belowT(°F) = T(°C) × 9/5 ... Read More

Product of the nodes of a Singly Linked List

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Sep-2019 08:01:06

256 Views

Given with n nodes the task is to print the product of all the nodes of a singly linked list. The program must traverse all the nodes of a singly linked list starting from the initial node till the NULL is not found.ExampleInput -: 1 2 3 4 5 Output ... Read More

Product of the alternate nodes of linked list

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Sep-2019 07:50:04

111 Views

Given with n nodes the task is to print the product of alternate node in a linked list. The program must only print the product of alternate nodes without actually changing the locations of the nodes.ExampleInput -: 10 20 30 40 50 60 Output -: 15000In the above example, starting ... Read More

Print the nodes of binary tree as they become the leaf node in C++ Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 07:29:57

67 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

Print matrix in zag-zag fashion in C Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 07:22:21

959 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

Print path between any two nodes in a Binary Tree in C++ Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 07:05:59

352 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

Print the first shortest root to leaf path in a Binary Tree in C++ Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 06:57:54

90 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

Print root to leaf paths without using recursion in C++ Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 06:45:51

128 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

Print the nodes at odd levels of a tree in C++ Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 06:38:59

87 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

Print Levels of all nodes in a Binary Tree in C++ Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 06:34:51

176 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

Advertisements