
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Narendra Kumar has Published 191 Articles

Narendra Kumar
296 Views
Problem statementGiven a linked list. Sort it using merge sort algorithmList: 10->20->8-17->5->13->4 Sorted list: 4->5->8->10->13->17->20Algorithm1. If head is NULL or list contains only one element then return list 2. Create two lists by dividing original list into 2 parts 3. Sort first and second part of list 4. Merge both ... Read More

Narendra Kumar
293 Views
Problem statementGiven two binary max heaps as arrays, merge the into single max heap.Heap1[] = {20, 17, 15, 10} Heap2[] = {19, 13, 7} Result[] = {20, 19, 15, 13, 17, 7, 10}Algorithm1.Create an array to store result 2. Copy both given arrays one by one to result array 3. ... Read More

Narendra Kumar
3K+ Views
Problem statementGiven 2 sorted arrays list. Write a function to merge given two sorted arrays into oneArr1[] = {10, 15, 17, 20} Arr2[] = {5, 9, 13, 19} Result[] = {5, 9, 10, 13, 15, 17, 19, 20}Algorithm1. Traverse both array 1.1. If arr1[i] < arr2[j] ... Read More

Narendra Kumar
3K+ Views
Problem statementGiven 2 sorted singly linked list. Write a function to merge given two sorted linked listsList1: 10->15->17->20 List2: 5->9->13->19 Result: 5->9->10->13->15->17->19->20Algorithm1. Traverse both lists 1.1. If list1->data < list2->data 1.1.1 Add list1->data to new list and increment list1 pointer 1.2 If list2->data < list1->data ... Read More

Narendra Kumar
842 Views
Problem statementGiven two arrays, we need to combine two arrays in such a way that the combined array has alternate elements of the first and second array. If one of the arrays has an extra element, then these elements should be appended at the end of the combined array.arr1[] = ... Read More

Narendra Kumar
457 Views
Problem statementWrite a function that takes two unsorted arrays and merges them into a new array in sorted order.arr1[] = {10, 5, 7, 2} arr2[] = {4, 17, 9, 3} result[] = {2, 3, 4, 5, 7, 9, 10, 17}Algorithm1. Merge two unsorted array into new array 2. Sort newly ... Read More

Narendra Kumar
3K+ Views
Problem statementThe mid-square method is a method of generating pseudorandom numbers. This method was invented by John von Neumann and was described at a conference in 1949In this technique, an initial seed value is taken and it is squared.Some digits from the middle are extracted and these extracted digits form ... Read More

Narendra Kumar
661 Views
DescriptionIn mathematics, a Mersenne prime is a prime number that is one less than a power of two. That is, it is a prime number of the form Mn = 2n − 1 for some integer n.Write a C++ program to print all Mersenne Primes smaller than an input positive ... Read More

Narendra Kumar
128 Views
Problem statementGiven N number of students and an array which represent the mark obtained by students. School has dicided to give them teddy as a price. Hoever, school wants to save money, so they to minimize the total number of teddies to be distrubuted by imposing following constrain −All students ... Read More

Narendra Kumar
133 Views
Problem statementGiven an array of n elements. The task is to create n/2 pairs in such a way that sum of squares of n/2 pairs is minimal.ExampleIf given array is −arr[] = {5, 10, 7, 4} then minimum sum of squares is 340 if we create pairs as (4, 10) ... Read More