
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

889 Views
In Swift, you can use the DateFormatter class to convert a string date to a date object. This class provides date conversion properties and methods. In this article, we will see some examples of date conversions. DateFormatter Class Swift's standard library has a class that is used to convert dates. It may be used to change a string into a date object and the other way around. To parse date objects in various formats, this class offers attributes and methods. You must build an object of the DateFormatter class in order to transform a string to a date object and ... Read More

335 Views
In Swift, a set is used to create an unordered collection of unique elements. To split a set into two halves we use a approach in which we first determine the midpoint of the given set using integer division method and then loop through the set and insert element into either the first half or second half set according to the index related to the midpoint. For example − Original Set - [2, 4, 5, 6, 7, 1] Set1 - [2, 4, 5] Set2 - [6, 7, 1] Algorithm Step 1 − Create a function which takes ... Read More

646 Views
Selection sort algorithm in swift is a sorting algorithm, in which it select smallest or largest element from the given unsorted array and place that element at the beginning of the unsorted array. This process continue till the last unsorted element. So now we sort an array in descending order using selection sort. For example − Array: [6, 10, 3, 7] 1st iteration − For the first position iterate through whole array starting from in 0 to 3. After traversing through whole array we find 10 is the greatest number so swap 6 with 10. Resultant Array: ... Read More

486 Views
Bubble sort algorithm in swift, is the easiest search algorithm. This algorithm sorts the elements by repeatedly swapping adjacent elements if they are not present at the right place. So now we sort an array in descending order using bubble sort. For example − Array - [4, 7, 1, 8] 1st iteration − compare two elements, if the first element is smaller than second element then swap their position. If not, then move to next pair. [4, 7, 1, 8] 41, remain same [7, 4, 1, 8] 14, remain same [7, 4, 8, 1] 41, remain same ... Read More

1K+ Views
Selection sort algorithm in swift is a sorting algorithm, in which it select smallest or largest element from the given unsorted array and place that element at the beginning of the unsorted array. This process continue till the last unsorted element. So now we sort an array in ascending order using selection sort. For example − Array: [6, 10, 3, 7] 1st iteration − For the first position iterate through whole array starting from in 0 to 3. After traversing through whole array we find 3 is the smallest number so for the 1st position swap 6 with ... Read More

728 Views
Quick sort algorithm in swift is a sorting algorithm which works on divide and conquer approach. In this sort, we first divide the array into subarrays by selecting a pivot element. Here the division takes place in such a way, in which the smallest elements placed at the left side of the pivot element and the largest element placed at the right side of the pivot element. Now the right and left subarrays are also divide using the same approach. This process continue till all the subarrays contain one element. At this point the array element are sorted now we ... Read More

2K+ Views
In swift, Bubble sort algorithm is the easiest search algorithm. This algorithm sorts the elements by repeatedly swapping adjacent elements if they are not present at the right place. So now we sort an array in ascending order using bubble sort. For example − Array - [4, 7, 1, 8] 1st iteration − compare two elements, if the first element is greater than second element then swap their position. If not, then move to next pair. [4, 7, 1, 8] 41, swap the position [4, 1, 7, 8] 71, swap the position [1, 4, 7, 8] 4

213 Views
Swift provide an in built function named as shuffle() to shuffle the elements of an array. This function takes a sequence or array and then shuffle the places of the elements present in the given array. Syntax func shuffle() Where this function does not take any parameter. Also it does not return any value instead it shuffle the places of the element in the given collection or array. Example In the following swift example, we will create and initialise an array of string type, then we shuffle the elements of the array using shuffle() function and display output. import ... Read More

659 Views
In Swift, super keyword in used to access or call the methods, properties, and initialisers of the superclass from the base class. Or we can say that super keyword add more functionality to the superclass by adding its own unique behaviour. You can use super keyword with class properties, methods, and initialisers. Example In the following swift example, we will create a superclass or base class named as Books with bookName property, init() initialiser and display() method. Then we create a subclass named as Author, it is inherits from Author class along with override initi() initialiser and display() method. In ... Read More

1K+ Views
In Swift, static keyword is used to define or create type-level properties and method that only belongs to the class itself rather than to its instances. Or we can say that we can directly access the static properties and methods of a class with help of class itself instead of creating the instance of the class. Algorithm Step 1 − Create a class. Step 2 − Inside the class define static property using static keyword and a instance property. Step 3 − Also define a static method using and static keyword and a instance method. Step 4 − Outside ... Read More