
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 2137 of 2651

261 Views
n-sided regular polygon is a closed figure of n sides that has all sides and angles of equal length. The below figure shows a 6 sided regular polygon commonly known as hexagon.Apothem is a line in the polygon that connects the center of the figure to the side. And it is perpendicular to one of its sides that makes it smallest in length.Now, let drive the formula for its length.The angle made by the side of an n sided polygon is 360/n.Now, as in the figure, the angle is equal to (360 / n )/2 = 180 /nNow taking the ... Read More

161 Views
In this article, we will learn an uncommon representation of array elements in both C and C++. Example of Uncommon Representation of Array Elements Consider following code in C/C++, that is trying to print an element from an array. C C++ #include int main() { int arr[2] = {0,1}; printf("First Element = %d",0[arr]); } Output The output of above program will be: First Element = 0 #include using namespace std; int main() { int arr[2] = {0,1}; cout

170 Views
A linked list is a data structure that stores data elements in linked form. Each node of the linked list has a data element and a link.Print reverse of a linked list is a common problem that needs to be addressed in problem solving. So, here we will learn an interesting way to print reverse of a linked list in c++ programming language.Generally print a reverse linked list needs modifications in the list or multiple traversing of the list but this method does not require any such things and also traverses the linked list only once.The logic of this method ... Read More

1K+ Views
What is the time complexity of insertion sort?Time complexity is the amount of time taken by a set of codes or algorithms to process or run as a function of the amount of input.For insertion sort, the time complexity is of the order O(n) i.e. big O of n in best case scenario. And in the average or worst case scenario the complexity is of the order O(n2).What will be the time complexity of sorting when insertion sort algorithm is applied to n sized array of the following form: 6, 5, 8, 7, 10, 9 …… I, i-1The time complexity ... Read More

628 Views
Amortized analysis for a sequence of operations is used to determine the run time, the average time required by the sequence. In cannot be treated as an average-case analysis done on the algorithm as it does not always take the average case scenario. There are cases that occur as a worst-case scenario of analysis. So, amortized analysis can be treated as a worst-case analysis for multiple operations in a sequence. Here, the cost of doing each operations in different and for some its high. This problem is a general view using the binary counter.Let’s see the working and implementation in ... Read More

226 Views
Python is one of the programming languages known for its simple syntax, readability. Whether working on development, data analysis, or automation, Python provides the tools to get the task done with less effort. But beyond the basics, Python has some hacks that make the code not only shorter but also more efficient. These are not bugs or workarounds, but the smart ways of using the Python built-in features and functions to solve tasks in a faster manner. In this article, we are going to learn about the amazing hacks of Python. Performing a Swap Without a ... Read More

305 Views
Problem statementN participants of the competition were split into M teams in some manner so that each team has at least one participant. After the competition each pair of participants from the same team became friends.Your task is to write a program that will find the minimum and the maximum number of pairs of friends that could have formed by the end of the competition.Algorithm1. We can obtain max pairs using below formula: maxPairs = ((n – m) * (n – m + 1)) / 2 2. We can obtain min pairs using below formula: minPairs = m * (((n ... Read More

229 Views
DescriptionGiven an array of size, N. Find an element X such that the sum of array elements should be minimum when XOR operation is performed with X and each element of an array.If input array is: arr [] = {8, 5, 7, 6, 9} then minimum sum will be 30 Binary representation of array elments are: 8 : 1000 5 : 0101 7 : 0111 6 : 0101 9 : 1001 If X = 5 then after performing XOR sum will be 30: 8 ^ 5 = 13 5 ^ 5 = 0 7 ^ 5 = 2 6 ^ ... Read More

259 Views
In this tutorial, we are going to write a program which finds all the occurrences of the 1(0+1) in a string using the regexes. We have a re module in Python which helps us to work with the regular expressions.Let's see one sample case.Input: string = "Sample 1(0+)1 string with 1(0+)1 unnecessary patterns 1(0+)1" Output: Total number of pattern maches are 3 ['1(0+)1', '1(0+)1', '1(0+)1']Follow the below steps to write the code for the program.Algorithm1. Import the re module. 2. Initialise a string. 3. Create a regex object using regular expression which matches the pattern using the re.compile(). Remember to ... Read More