
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

3K+ Views
In Swift, we can find the second largest element from the given array using the sort() function or using user defined function. For example, we have the following array − Array = [34, 23, 1, 45, 3] Hence the largest element is 45 and the second largest element is 34. So lets discuss both the methods in detail along with examples. Method 1 In this method, we find the second largest element from the specified array by creating user defined function. Example In the following example, we will create a function named as ‘secondlargestElement’, it takes an array as ... Read More

2K+ Views
In Swift, a set is used to define an unordered collection of unique elements whereas an array is used to define an ordered collection with may or may not be unique elements. To convert a set into an array Swift provides an inbuilt initializer named as Array(). Syntax Array(MySet) Where Array() initializer takes only one parameter that is the name of the set and, returns an array of the same type. Example In the following example, we will create and initialize a set of strings. Then convert the set into the array using Array() initializer and then display the ... Read More

2K+ Views
Swift provide a inbuilt method named as joined() to convert a set of string to comma separated string. This function return the concatenated elements of the given sequence by inserting the given separator in between each element of the sequence. Syntax func joined(separator: sep) Where the separator parameter contains a string or sequence, which is further used to insert between each element of the given sequence. This function returns a concatenated or joined sequence of elements. Example In the following code, we will create and initialize a set of strings. Then we join the elements of the set ... Read More

302 Views
Swift provide an equality operator(==) to check if the given two sets are equal or not. Here the equality of two the sets means that both the sets should be identical in terms of their size and elements. So if both the sets are identical or the same, then the equality operator returns true. Otherwise, the equality operator will return false. Syntax set1 == set2 Where set1 and set2 are two sets and using the == operator we check if they are equal or not. This operator will return true if both sets are equal. Else it will return ... Read More

496 Views
In Swift, a set is used to create a collection of unique elements. In a set, the elements are not arranged in a particular order. Now to check if a set is empty or not Swift provide an inbuilt property named as isEmpty. This property will return true if the given set is empty. Otherwise it will return false. Syntax newSet.isEmpty Where newSet is the name of the set and we can access the isEmpty property using the dot operator. This property's return type is bool, meaning if it returns true, it means the set is empty. If it ... Read More

240 Views
In swift, a complex number is the combination of real and imaginary number. So we create a class to store the real and imaginary part of the complex number and then we pass this class in the function to find the sum of two complex numbers. Algorithm Step 1 − Create a class to store the real and imaginary part of the complex number. Step 2 − Create a function named as ‘add’ which takes two class objects as a parameters and return the sum of the two complex numbers by adding the real and imaginary part ... Read More

732 Views
In Swift, set is used to create an unordered collection of unique elements. Swift provide inbuilt functions named as formUnion() and insert() function to insert elements to a set. Lets discuss both the methods in detail along with examples. Method 1: Using formUnion(_:) function The formUnion(_:) function is used to insert elements of the given collection into the set. Syntax func formUnion(newSequence) Where newSequence represents a collection of elements, it can be either an array or set. Also the newSequence collection must a finite collection. This function does not return any value it only add new element into the ... Read More

2K+ Views
In Perl, we can find the number of matches in a string by different approaches. In this tutorial, we will discuss the three most widely used approaches. Searching for a Single Character in a Perl String Let's first take the case where we would want to search for a single character pattern in a string. For example, let's suppose we have a string that look something like this − "India.Japan.Russia.USA.China" And, we want to find the number of times "." (dot) appears in the above string. Example Consider the code shown below. my $countries ... Read More

3K+ Views
There are times when we would want to know how many key-value pairs are present in a hash. These key-value pair counts are also known as the size of the hash. In Perl, we can find the number of keys in a Perl hash by using the "scalar" keyword or "keys" keyword. In this tutorial, we will explore two Perl examples where we will calculate the number of keys in a hash. Example Consider the code shown below. In this code, we have declared a hash named "countries" and in that hash, we have different countries, each having ... Read More

988 Views
The conversion between binary to decimal and decimal to binary is a necessity when it comes to dealing with binary data and using them in some simple applications. In Perl, we can convert from decimal to binary and vice versa in multiple ways. In this tutorial, we will explore different examples where we will first convert a decimal value into a binary value and then a binary value into a decimal value. Decimal to Binary in Perl Let's first see an example where we are given two decimal values and we want to convert them to their binary representation. ... Read More