Sunidhi Bansal has Published 1085 Articles

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

Sunidhi Bansal

Sunidhi Bansal

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

201 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

145 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

311 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

550 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

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

Print numbers in sequence using thread synchronization in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:15:18

7K+ Views

Given with the threads the program must print the thread based on their priorities starting from 0 to 10.What is a thread?Thread is lightweight process that runs inside a program. A simple program can contain n number of threads.Unlike java, multithreading is not supported by the language standards, POSIX Threads ... Read More

Print leftmost and rightmost nodes of a Binary Tree in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:11:00

1K+ Views

Given a binary tree with left and right children and the task is to print the exact right and left child of the given tree.Leftmost nodes are the nodes which are associated on the left side from the parent node of the tree and rightmost nodes are which are associated ... Read More

Print maximum sum square sub-matrix of given size in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 07:04:58

625 Views

Given a matrix of NxN find a sub matrix of MxM where M=1 such that addition of all the elements of matrix MxM is maximum. Input of matrix NxN can contain zero, positive and negative integer values.ExampleInput:    {{1, 1, 1, 1, 1},    {2, 2, 2, 2, 2},   ... Read More

Print left rotation of array in O(n) time and O(1) space in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 06:54:19

176 Views

We are given an array of some size n and multiple integer values, we need to rotate an array from a given index k.We want to rotate an array from a index k like −ExamplesInput: arr[] = {1, 2, 3, 4, 5}    K1 = 1    K2 = 3 ... Read More

Print k different sorted permutations of a given array in C Program.

Sunidhi Bansal

Sunidhi Bansal

Updated on 22-Aug-2019 06:49:37

209 Views

Given an array a[] containing N integers, the challenge is to print k different permutations of indices such that the values at those indices form a non-decreasing sequence. Print -1 if it is not possible.ExampleInput: arr[] = {2, 5, 6, 2, 2, 2, 2}, k = 4 Output:    0 ... Read More

Advertisements