
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
Found 26504 Articles for Server Side Programming

203 Views
Suppose we have two sorted arrays A1 and A2, and another value k. We have to define a pair (u, v) which is consists of one element from A1 and another element from A2. We have to find the k pairs like [(u1, v1), (u2, v2), …, (uk, vk)]. So if A1 = [1, 7, 11] and A2 = [2, 4, 6], and k = 3, then output will be [(1, 2), (1, 4), (1, 6)]To solve this, we will follow these steps −Define one data type, that will take two values a and b, and index.create one priority queue, ... Read More

143 Views
Suppose we have a binary tree, where each node has following fields: (data, left, right, next), the left will point to left subtree, right will point to right subtree, and the next pointer will point to the next node. If there is no node in the right hand side, then that will be null. So initially each next pointer is set to null, we have to make the links. Suppose the tree is like the first one, it will be converted to the next node −To solve this, we will follow these steps −set pre := root, nextPre := null ... Read More

277 Views
Suppose we have a complete binary tree, where each node has following fields: (data, left, right, next), the left will point to left subtree, right will point to right subtree, and the next pointer will point to the next node. If there is no node in the right hand side, then that will be null. So initially each next pointer is set to null, we have to make the links. Suppose the tree is like the first one, it will be converted to the next node −To solve this, we will follow these steps −set pre := root, nextPre := ... Read More

295 Views
Suppose we have a linked list, we have to perform the insertion sort on this list. So if the list is like [9, 45, 23, 71, 80, 55], sorted list is [9, 23, 45, 55, 71, 80].To solve this, we will follow these steps −dummy := new Node with some random valuenode := given listwhile node is not null, newNode = next of node, dummyHead := next of dummy, prevDummyHead := dummywhile true −if dummyHead is not present, value of dummyHead > value of nodenext of node := dummyHeadnext of prevDummyHead := nodebreak the loopprevDummyHead := dymmyHead, and dummyHead = ... Read More

318 Views
Suppose we have a 2D board containing X and O. Capture all regions surrounded by X. A region is captured by changing all Os into Xs in that surrounded region.XXXXXOOXXXOXXOXXAfter running the output will beXXXXXXXXXXXXXOXXTo solve this, we will follow these steps −If board is not present, then return blank boardfor i in range 0 to number of rows – 1 −if board[i, 0] = ‘O’, then make_one(board, i, 0)if board[i, length of row - 1] = ‘O’, then make_one(board, i, length of row – 1)for i in range 0 to number of cols – 1 −if board[0, i] = ... Read More

310 Views
Consider we have an array sorted in ascending order. That is rotated at some pivot unknown to us beforehand. For example, if the array is like [0, 0, 1, 2, 2, 5, 6], this might become [2, 5, 6, 0, 0, 1, 2]. We have a target value to search. If that is found in the array, then return true, otherwise return false. So if the array is like [2, 5, 6, 0, 0, 1, 2], and target is 0, then the output will be 0Let us see the steps −low := 0 and high := size of arraywhile low ... Read More

769 Views
Suppose we have a m x n matrix filled with non-negative integers, find a path from top left corner to bottom right corner which minimizes the sum of all numbers along its path. Movements can only be either down or right at any point in time. So for example, if the matrix is like below131151421The output will be 7, the path will be 1, 3, 1, 1, 1, this will minimize the sumLet us see the steps −a := number of rows, b := number of columnsi := a – 1, j := b – 1while j >= 0matrix[a, j] ... Read More

366 Views
Suppose we have a triangle. We have to find the minimum path sum from top to the bottom. In each step, we can move to adjacent numbers on the row below.For example, if the following triangle is like[ [2], [3, 4], [6, 5, 7], [4, 1, 8, 3] ]The minimum path sum from top to bottom is 11 (2 + 3 + 5 + 1 = 11).Let us see the steps −Create one table to use in Dynamic programming approach.n := size of trianglefor i := n – 2 down to 0for ... Read More

504 Views
In this tutorial, we are going to learn how to calculate Wind Chill Index in Python. We have the formula to calculate the WCI and it's straightforward. We are going to use the following formula to calculate the WCI.Twc(WCI) = 13.12 + 0.6215Ta – 11.37v+0.16 + 0.3965Tav+0.16whereTwc = Wind Chill Index (Based on Celsius temperature scale)Ta = Air Temperature (in degree Celsius)v = Wind Speed (in miles per hour)We are going to use the math module function wherever we need them. Using the math module function decreases the execution time of a program.Follow the below steps to complete the program.Import the math moduleInitialize the ... Read More

1K+ Views
In this tutorial, we are going to explore different methods to find whether a given number is valid or not. Let's start without further due.Method-1It's a general method to find prime numbers.If the number is less than or equal to one, return False.If the number is divisible by any number, then the function will return False.After the loop, return True.Example Live Demo# checking for prime def is_prime(n): if n