Sunidhi Bansal has Published 1100 Articles

Print numbers in matrix diagonal pattern in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:54:13

2K+ Views

The task is to print the matrix of n x n of the diagonal pattern.If n is 3 then to print a matrix in Diagonal pattern is −So the output will be like −ExampleInput: 3 Output:    1 2 4    3 5 7    6 8 9 Input: 4 ... Read More

Print the last k nodes of the linked list in reverse order Recursive Approaches in C language

Sunidhi Bansal

Sunidhi Bansal

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

112 Views

The task is to print the k nodes starting from the end of the linked list using recursive approach.Recursive approach is the one in which the function call itself again and again till the call is being made and hence stores the result.Let’s say, list contains the nodes 29, 34, ... Read More

Print the alternate nodes of linked list (Iterative Method) in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:50:52

763 Views

In this problem, program must print the alternates from the given linked list that is leaving one printing other and so on using iterative method.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 nodes 29, ... Read More

Print reverse of a Linked List without actually reversing in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:48:12

248 Views

The task is to print the reverse of a given linked list by using recursive function. The program must print the reverse but not reverse the list that means the order of the nodes remains the sameHere, the program will move head pointer containing the address of a first node ... Read More

Print pair with maximum AND value in an array in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:45:50

154 Views

According to the problem we are given an array of n positive integers, we have to find a pair with maximum AND value from the array.ExampleInput: arr[] = { 4, 8, 12, 16 } Output: pair = 8 12 The maximum and value= 8 Input:arr[] = { 4, 8, ... Read More

Print Right View of a Binary Tree in C language

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:45:40

305 Views

The task is to print the right nodes of a given binary tree. Firstly user will insert data for creating a binary tree and than print right view of the tree so formed.The above diagram showcase the binary tree created with the nodes 10, 42, 93, 14, 35, 96, 57 ... Read More

Print middle level of perfect binary tree without finding height in C language

Sunidhi Bansal

Sunidhi Bansal

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

139 Views

The program should print the middle level of a binary tree e.g. if there are 4 levels in a binary tree than the program must print the level 2 nodes but the demand here is to calculate the level without finding the height.Perfect binary tree is a tree in which ... Read More

Print leaf nodes in binary tree from left to right using one stack in C++

Sunidhi Bansal

Sunidhi Bansal

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

148 Views

Program should print the leaf nodes of a binary tree from left to right but the challenge involves is using of only one stackThrough push() function insert nodes of a binary tree and through pop() operation display the leaf nodes.Leaf nodes are the end nodes whose left and right pointer ... Read More

Print the longest prefix of the given string which is also the suffix of the same string in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 08:36:54

1K+ Views

Given a string in which we have to check that the length of the longest prefix which is also a suffix of the string like there is a string “abcab” so here “ab” is of length 2 and is the longest substring with same prefix and suffix.ExampleInput: str[] = { ... Read More

Print Leaf Nodes at a given Level in C language

Sunidhi Bansal

Sunidhi Bansal

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

815 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

Advertisements