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
Server Side Programming Articles - Page 1680 of 2646
244 Views
A Continuous Tree is defined as a tree with any path from root node to leaf node has value or weight of nodes such that the absolute difference between the parent node and all of its direct children nodes is always 1.If we pick any node on the path from root to leaf, then|weight of node-weight of left child node|=|weight of left child node-weight of node| = 1, this holds true for right child as well|weight of node-weight of right child node|=|weight lof right child node-weight of node| = 1DiagramLet us understand with examples.The tree below is continuous as absolute ... Read More
704 Views
Derangement is permutation of N numbers such that no number appears at original position. For example one possible derangement of { 1, 2, 3 } is { 2, 1, 3 }. No element in this is at its original position. The goal here is to count the possible derangements for N numbers.We will do this using a recursive solution. For following no. of elements −N=0, no derangement, return 1N=1, only one number, return 0N=2, only one swap of position possible, { 1, 2 } → { 2, 1 }, return 1N=3, 2 possible permutations eg, { 1, 2, 3 } ... Read More
3K+ Views
If we go by the term Content Management System word to word, then it basically means a system of managing the content. It is defined as a collaborative platform with different features and functionalities that allow the creating, designing, publishing and maintaining web content easily and effectivelWhat is a Content Management System (CMS)?A Content Management System is a software application used to create and design the web content online. It allows the users to manage the digital content easily by providing access to features like database handling, smart reporting, archiving, designing and animation features etc. These are generally used in ... Read More
148 Views
We are given a string containing (, ), {, }, [, ] characters only. The goal is to find the maximum length of such string so that it becomes balanced by swapping adjacent characters or removing a character. We will do this by comparing adjacent characters, if they are opposite of each other then they can be swapped. ( }{, )(, ][ can be swapped, while {{, )), [[, }}, )), ]] cannot be swapped ).Also if a character has no matching pair, then it can be removed also. ( “{{}][“, here first { can be removed and balanced string ... Read More
661 Views
We are given N rupees. The goal is to buy maximum water possible with the money where the rates of water bottles are as follows −Plastic Bottles: A Rupees for 1 litreGlass Bottles: B Rupees for 1 litreGlass Bottles: B Rupees for 1 litreNow the original cost of glass bottles becomes B-E rupees. After returning.If the cost of plastic bottles is still less than B-E, then only buy plastic bottles. Else buy N-E/B-E glass bottles and spend rest on plastic bottles.InputN = 6, A = 5, B = 4, E = 3;OutputMaximum litres of water: 3Explanation − B-E=1, 1A n/a= ... Read More
169 Views
We are given an array of numbers say Arr1[] and another array Arr2[] of same or different length. The Arr1[] has elements sorted in ascending order, such that a single element is unsorted. We must find the element from the second array Arr2[] such that it can replace the wrongly placed element of Arr1[] and make it sorted. Also, the element chosen from Arr2[] should be maximum if there are multiple options available.InputArr1[]= { 1,3,5,7,2,11 }, Arr2[]= { 4,8,7,10,9 }OutputMaximum element that can make Arr1 sorted: 10Explanation − Numbers in Arr2[] that can make Arr1[] sorted − 8,9,10 as they all are >=7 and =12 and
3K+ Views
Turing Machine − A Turing machine is a device used to accept words of a language generated by type 0 grammars. A Turing Machine (TM) is a mathematical model which consists of an infinite length tape divided into cells on which input is given. It consists of a head which reads the input tape. A state register stores the state of the Turing machine. After reading an input symbol, it is replaced with another symbol, its internal state is changed, and it moves from one cell to the right or left. If the TM reaches the final state, the input ... Read More
369 Views
We are given with a matrix of numbers. The goal is to find the number of Magic squares present inside the given matrix.A Magic Square, if taken as a matrix, is a 3X3 matrix which contains the elements ranging from 1 to 9 just like a grid in Sudoku. Properties are −All numbers occur exactly once.Sum of all 9 cells in the matrix is 45.Sum of each row of 3 is 15.Sum of each column of 3 is 15.Sum of diagonals of 3 is 5.To get such sums, 5 is always in the middle of both diagonals.Inputint arr[][]= { { ... Read More
422 Views
We are given with integers a, b, c, n. The goal is to maximize the sum of x, y and z such that ax+by+cz=n.From above formula, cz=n-(ax+by) z= (n- (ax+by))/cBy fixing x and y, calculate z using the above formula, for each x, y and z. Calculate sum and store the maximum such sum obtained.Inputn = 6, a = 3, b = 4, c = 5;Outputmaximum x+y+z is 2.Explanation − for x=2, y=0 and z=0 ax+by+cz=n.3*2+0*4+0*5=6 = nInputn = 4, a = 3, b = 1, c = 2;Outputmaximum x+y+z=4Explanation − for x=0, y=4 and z=4 ax+by+cz=n.0*3+4*1+0*2=4 = nApproach used ... Read More