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 2118 of 2650
201 Views
The Tuple class represents a 5-tuple, which is called quintuple. A tuple is a data structure that has a sequence of elements.It is used in −Easier access to a data set.Easier manipulation of a data set.To represent a single set of data.To return multiple values from a methodTo pass multiple values to a methodIt has five properties −Item1− Get the value of the current Tuple object's first component.Item2− Get the value of the current Tuple object's second component.Item3− Get the value of the current Tuple object's third component.Item4− Get the value of the current Tuple object's fourth component.Item5− Get the ... Read More
247 Views
Pandas is the important package for data analysis in Python. There are different versions available for Pandas. Due to some version mismatch, it may create some problems. So we need to find the version numbers of the Pandas. We can see them easily using the following code.We can use the command like below, to get the version −pandas.__version__Example>>> import pandas as pd >>> print(pd.__version__) 0.25.2 >>>We can also get the version of the dependencies using the function like below −pandas.show_versions() >>> pd.show_versions() INSTALLED VERSIONS ------------------ commit : None python : 3.7.1.final.0 python-bits : 64 OS : Windows OS-release : 7 ... Read More
3K+ Views
The Math.Floor() method in C# is used to return the largest integral value less than or equal to the specified number.Syntaxpublic static decimal Floor (decimal val); public static double Floor (double val)For the first syntax above, the value val is the decimal number, whereas Val in the second syntax is the double number.Let us now see an example to implement Math.Floor() method −Exampleusing System; public class Demo { public static void Main(){ decimal val1 = 7.10M; decimal val2 = -79.89M; Console.WriteLine("Result = " + Math.Floor(val1)); Console.WriteLine("Result = ... Read More
279 Views
The Math.Exp() method in C# is used to return e raised to the specified power.Syntaxpublic static double Exp (double val);Here, Val is the power.If Val equals NaN or PositiveInfinity, that value is returned. However, if d equals NegativeInfinity, 0 is returned.Let us now see an example to implement Math.Exp() method −Exampleusing System; public class Demo { public static void Main(){ Console.WriteLine(Math.Exp(0.0)); Console.WriteLine(Math.Exp(Double.PositiveInfinity)); Console.WriteLine(Math.Exp(Double.NegativeInfinity)); } }OutputThis will produce the following output −1 ∞ 0Let us see another example to implement Math.Exp() method −Exampleusing System; public class Demo { public ... Read More
130 Views
We have to take a number Y, we will find smallest number X, such that X! contains at least Y number of training zeros. For example, if Y = 2, then the value of X = 10. As X! = 3228800. It has Y number of zeros.We can solve this using binary search. The number of trailing zeros in N! is given by the count of the factors 5 in N!. X can be found using binary search in range [0, 5*Y]Example #include using namespace std; int factorCount(int n, int X) { if (X < n) ... Read More
2K+ Views
Suppose we have an array of n elements. We have to find the first, second smallest elements in the array. First smallest is the minimum of the array, second smallest is minimum but larger than the first smallest number.Scan through each element, then check the element, and relate the condition for first, and second smallest elements conditions to solve this problem.Example #include using namespace std; int getTwoSmallest(int arr[], int n) { int first = INT_MAX, sec = INT_MAX; for (int i = 0; i < n; i++) { if (arr[i] < first) { ... Read More
2K+ Views
The Math.DivRem() method in C# is used to divide and calculate the quotient of two numbers and also returns the remainder in an output parameter.Syntaxpublic static int DivRem (int dividend, int divisor, out int remainder); public static long DivRem (long dividend, long divisor, long remainder);Let us now see an example to implement Math.DivRem() method −Exampleusing System; public class Demo { public static void Main(){ int dividend = 30; int divisor = 7; int remainder; int quotient = Math.DivRem(dividend, divisor, out remainder); Console.WriteLine("Quotient = "+quotient); ... Read More
489 Views
The Char.IsWhiteSpace() method in C# is used to indicate whether the specified Unicode character is white space.Syntaxpublic static bool IsWhiteSpace (char ch);Above, the parameter ch is the Unicode character to evaluate.Let us now see an example to implement the Char.IsWhiteSpace() method −Exampleusing System; public class Demo { public static void Main(){ bool res; char val = ' '; Console.WriteLine("Value = "+val); res = Char.IsWhiteSpace(val); Console.WriteLine("Is the value whitespace? = "+res); } }OutputThis will produce the following output −Value = Is the value whitespace? ... Read More
2K+ Views
The Dictionary.Clear() method in C# removes all key/value pairs from the Dictionary.Syntaxpublic void Clear();Let us now see an example to implement the Dictionary.Clear() method −Exampleusing System; using System.Collections.Generic; public class Demo { public static void Main(){ Dictionary dict = new Dictionary(); dict.Add("One", "John"); dict.Add("Two", "Tom"); dict.Add("Three", "Jacob"); dict.Add("Four", "Kevin"); dict.Add("Five", "Nathan"); Console.WriteLine("Count of elements = "+dict.Count); Console.WriteLine("Key/value pairs..."); foreach(KeyValuePair res in dict){ Console.WriteLine("Key = {0}, ... Read More
162 Views
Consider we have few elements in a linked list. We have to find the multiplication result of last n number of elements. The value of n is also given. So if the list is like [5, 7, 3, 5, 6, 9], and n = 3, then result will be 5 * 6 * 9 = 270.The process is straight forward. We simply read the current element starting from left side, then add the elements into stack. After filling up the stack, remove n elements and multiply them with the prod. (initially prod is 1), when n number of elements are ... Read More