Sudhir sharma has Published 1206 Articles

Print all paths from top left to bottom right in a matrix with four moves allowed in C++

sudhir sharma

sudhir sharma

Updated on 16-Jan-2020 12:39:11

178 Views

In this problem, we are given an mXn 2D matrix and we have to print all possible paths from top left to bottom right of matrix. For traversal, we can move in all four directions i.e. left, right, top, bottom.Thought the moves right and top are rarely used but these ... Read More

Print all permutations in sorted (lexicographic) order in C++

sudhir sharma

sudhir sharma

Updated on 16-Jan-2020 12:29:24

436 Views

In this problem, we are given a string of length n and we have to print all permutations of the characters of the string in sorted order.Let’s take an example to understand the problem :Input: ‘XYZ’Output: XYZ, XZY, YXZ, YZX, ZXY, ZYX.Here we have to print all permutations in lexicographical ... Read More

Print all valid words that are possible using Characters of Array in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 10:13:33

157 Views

Ib this problem, we are given a set of words and an array of character and we have to check if the words are possible using the characters of the array.Let’s take an example to understand the problem better −Input : words[] : {‘go’ , ‘hi’ , ‘run’ , ‘on’ ... Read More

Print all ways to break a string in bracket form in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 10:10:23

105 Views

In this problem, we are given a string and we have to break it into substrings and print them enclosing brackets.Let’s take a few examples to understand the problem better, Input : wxyz Output :    (w) (x) (y) (z)    (w) (x) (yz)    (w) (xy) (z)    (w) ... Read More

Print all words matching a pattern in CamelCase Notation Dictionary in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 10:07:39

247 Views

In this problem, we are given an array of string in camelcase and a pattern. We have to print all those string of the array that match the given pattern.The array of string is an array in which elements are of the string data type.camelCase is a common method for ... Read More

Print alternate nodes of a linked list using recursion in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 10:03:30

143 Views

A linked list is a linear data structure that stores the element in non-contiguous memory locations. Every element contains a pointer to the next element of the linked list.Example −In this problem, we are given a linked list and we need to print the elements of this linked list but ... Read More

Print an N x M matrix such that each row and column has all the vowels in it in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 10:00:21

225 Views

In this problem, we have to create a 2D matrix of size n X m. And in this matrix, we have to place only vowels in such a way that each row and column has all vowels in it.All vowels mean all a, e, i, o, u are present in ... Read More

Print ancestors of a given binary tree node without recursion in C++

sudhir sharma

sudhir sharma

Updated on 03-Jan-2020 09:57:21

114 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 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

366 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

Advertisements