- 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
Narendra Kumar has Published 196 Articles
Narendra Kumar
787 Views
Problem statementGiven a string of size ‘n’. The task is to delete a minimum number of characters to make string palindrome.If the given string is “abcda” then we can delete any 2 characters except first and last to make it a palindrome.If we delete character ‘b’ and ‘c’ then “ada” ... Read More
Narendra Kumar
252 Views
DescriptionGiven two strings str1 and str2 of size m and n respectively. The task is to delete and insert a minimum number of characters from/in str1 so as to transform it into str2.Str1 = “tutorialspoint” Str2 = “tutorials” To transform str1 to str2 we have to delete five characters i.e. ... Read More
Narendra Kumar
485 Views
Problem statementGiven a set of time intervals in any order, merge all overlapping intervals into one and output the result which should have only mutually exclusive intervalsGiven set of interval is {{12, 14}, {11, 13}, {20, 22}, {21, 23}} thenInterval {12, 14} and {11, 13} overlap with each other hence ... Read More
Narendra Kumar
402 Views
Problem statementGiven a doubly 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 ... Read More
Narendra Kumar
162 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
163 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
2K+ 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
2K+ 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
622 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
324 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
To Continue Learning Please Login
Login with Google