Sunidhi Bansal has Published 1100 Articles

Print level order traversal line by line in C++ Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 06:23:17

293 Views

Given the binary tree, the function must find out the level order traversal of a tree line by line.Level order traversal: Left Root Right, which means firstly print left child of a node than the value of a root and then go to the right child but here we have ... Read More

Print matrix in snake pattern from the last column in C Programming.

Sunidhi Bansal

Sunidhi Bansal

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

251 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

Print matrix in snake pattern in C Programming.

Sunidhi Bansal

Sunidhi Bansal

Updated on 04-Sep-2019 06:08:53

3K+ 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

Print symmetric double triangle pattern in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 09:42:30

266 Views

Given with number of lines the program must print the symmetric double triangle pattern with least complexity.ExampleInput: 5 Output:  X           X           O X            O X     X O X O X   ... Read More

Print shortest path to print a string on screen in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 09:14:49

204 Views

Given a string, the program must display the shortest path which will print the string over the screen using that shortest path.Like screen will store alphabets in the formatA B C D E F G H I J K L M N O P Q R S T U V ... Read More

Print numbers with digits 0 and 1 only such that their sum is N in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 09:09:48

224 Views

Given an integer n, the task is to print the numbers who consist only 0’s and 1’s and their sum is equal to the integer n.The numbers which contain only zeros and ones are 1, 10, 11 so we have to print all those numbers which can be added to ... Read More

Print sorted distinct elements of array in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 09:08:29

428 Views

Given with an array of integer elements, the task is to remove the duplicate values and print the distinct elements in sorted manner.Given below is an array that stores integer type values in the fashion 4, 6, 5, 3, 4, 5, 2, 8, 7 and 0 now, the result will ... Read More

Print nodes of linked list at given indexes in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 09:00:19

5K+ Views

We have to print the data of nodes of the linked list at the given index. Unlike array linked list generally don’t have index so we have to traverse the whole linked list and print the data when we reached a particular.Let’s say, list contains the nodes 29, 34, 43, ... Read More

Print n x n spiral matrix using O(1) extra space in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 09:00:13

346 Views

We are given an positive integer n and make a spiral matrix of n x n, with only using O(1) extra space in clockwise directionSpiral matrix is a matrix that works like a spiral which will start from the origin of a circle and rotates in clockwise fashion. So the ... Read More

Print the last k nodes of the linked list in reverse order Iterative approach in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:56:14

153 Views

We have to print the k number of nodes of the linked list in reverse order. We have to apply the iterative approach to solve this problem.Iterative method is the one which generally uses loops that are executed till the condition holds value 1 or true.Let’s say, list contains the ... Read More

Advertisements