- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Sunidhi Bansal has Published 1101 Articles
Sunidhi Bansal
480 Views
Given with an array of elements and the task is to print those numbers whose digit sum is also prime and return -1 is not such digit exists in an arrayInput: arr[]={2, 4, 3, 19, 25, 6, 11, 12, 18, 7} Output : 2, 3, 25, 11, 12, 7Here, the ... Read More
Sunidhi Bansal
135 Views
The task is to print the given n number which have exactly two set bits that neither less than 2 nor more than 2.Set bits in computer language are the one that have value 1 and unset bits have value as 0Input: value of num=5 Output: 1 3 5 ... Read More
Sunidhi Bansal
871 Views
Given with inorder and preorder of a tree program must find the postroder traversal and print the sameInput: Inorder traversal in[] = {4, 2, 5, 1, 3, 6} Preorder traversal pre[] = {1, 2, 4, 5, 3, 6} Output: Postorder traversal post[] = {4, 5, 2, 6, 3, 1}AlgorithmSTART Step ... Read More
Sunidhi Bansal
902 Views
Given with a linked list program must print the list starting from the end till the front using the stack data structureInput : 10 -> 5 -> 3 -> 1 -> 7 -> 9 Output: 9 -> 7 -> 1 -> 3 -> 5 -> 10Here the user can use ... Read More
Sunidhi Bansal
257 Views
As per the question, the task is to find the nearest prime number by adding the prime number starting from 2 if the number N is not Prime.Input: N=6 Output: 11ExplanationSince 6 is not prime add first prime to 6 i.e. 2 which will result to 8 now 8 is ... Read More
Sunidhi Bansal
106 Views
GCDGCD stands for Greatest Common Divisor of two or more integers excluding 0Like, to find the greatest common divisor of 48 and 18048 = 2 × 2 × 2 × 2 × 3180 = 2 × 2 × 3 × 3 × 5Greatest common divisor = 2 × 2 × ... Read More
Sunidhi Bansal
232 Views
Given with two numbers x and y the output should contain their kth common factor.Input: x=9 y=18 k=1 Output : k common factor = 2 Factors of 9 : 1, 3, 9 Factors of 18 : 1, 2, 3, 6, 9, 18 Greatest Common Factor : 9AlgorithmSTART Step 1 -: ... Read More
Sunidhi Bansal
255 Views
Newman-Conway Sequence is used for generating following integer sequence.1 1 2 2 3 4 4 4 5 6 7 7 8 8 8 8 9 10 11 12Formula used for generating Newman-Conway sequence for n numbers is −P(n) = P(P(n - 1)) + P(n - P(n - 1)) Where, p(1) ... Read More
Sunidhi Bansal
167 Views
Given with array of let’s say k elements the program must find the n smallest elements amongst them in their appearing order.Input : arr[] = {1, 2, 4, 3, 6, 7, 8}, k=3 Ouput : 1, 2, 3 Input k is 3 it means 3 shortest elements among the set ... Read More
Sunidhi Bansal
55 Views
Given with equation program must find the value of ‘a’ where a+b Declare start variables b=10, x=9, n=40 and flag=0, divisible Step 2 -> Loop For divisible = (b / x + 1 ) * x and divisible = 1 Print divisible-1 Set flag=1 ... Read More