Found 26504 Articles for Server Side Programming

Golang program to insert an element into a priority queue

Akhil Sharma
Updated on 06-Jul-2023 16:05:15

289 Views

When working with go language there may be cases such as sorting, managing urgent events such as job scheduling, and more where you need to prioritize the element based on their urgency number. In this article, we will write a Go language program to insert an element into a priority queue. A priority queue is a type of queue in which every stored element has a priority. The elements are added in the priority queue using the enqueue operation and removed from the queue using the dequeue operation. Syntax func make ([] type, size, capacity) The make ... Read More

Golang program to create a priority queue

Akhil Sharma
Updated on 05-Jul-2023 16:39:44

3K+ Views

A priority queue is a type of queue in which priorities are assigned to the elements and the elements with higher priority are popped out first than the elements with lower priority. In this article, we will write Golang programs to create a priority queue. They can be implemented using heaps, slices, trees etc and are used to perform the operations such as pushing elements in queue and removing elements from queue. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be ... Read More

Check whether a very large number of the given form is a multiple of 3

Rinish Patidar
Updated on 21-Jun-2023 12:28:28

343 Views

The problem statement includes checking whether a K-sized very long positive integer is the multiple of 3 or not where each ith digit in the K-sized number where i>1 will be the sum of all the prefix digits modulo 10 from the left. We will be given two integers a0 and a1, where 1

Check whether a number is Emirpimes or not

Rinish Patidar
Updated on 21-Jun-2023 12:26:20

304 Views

The problem statement includes checking whether a number is Emirprimes or not, where the positive integer N will be the user input. An Emirpimes number is a semiprime number whose when digits are being reversed, gives a new number which too is a semiprime number. A semiprime number is a number which is the product of two prime numbers which can be either distinct or the same. In simple words, for a number N to be semiprime it should be of the form N=a*b, where a and b are prime numbers. They can be equal. In this problem, we will ... Read More

Blum Integer

Rinish Patidar
Updated on 21-Jun-2023 12:23:24

365 Views

The problem statement includes checking the given numbers which will be the user input, if it is a Blum number or not. A Blum integer is a semiprime number whose distinct prime factors a and b are of the form 4t+3, where t is some positive integer. A semiprime number is a number which is a product of exactly two prime numbers or a natural number which has exactly two factors which are prime numbers. In case of semiprime numbers, the factors may be equal. In case any number N which is a blum integer, it must have only two ... Read More

Swift program to generate an OTP

Ankita Saini
Updated on 15-Jun-2023 16:16:30

638 Views

An OTP is known as a one-time password. It is an automatically generated random numeric string which is used for a single login session or transaction on digital devices. It is generally used to enhance security by providing extra authentication. For example, “423193”, “489201’, etc. To generate OTP Swift provides the following methods − Using random() method Using randomElement() method Method 1: Using random() method As we know that OTP is a randomly generated string. So to generate a random string Swift provide an inbuilt function named as random(). It is used to create a random string of ... Read More

Swift program to generate a password

Ankita Saini
Updated on 15-Jun-2023 16:35:50

673 Views

A password is a combination of various characters of a specified length and is used to authenticate or gain access to the system or login to an account. It is designed for security purposes and ensures that only an authorized user can access or log in to the specific account. It is important to select a strong password so that other people cannot crack it. It is generated according to the following conditions − Contains at least one uppercase letter. Contains at least one lowercase letter. Contains at least one number. Length must be 8 characters Contains at ... Read More

Swift program to find the longest word in a string

Ankita Saini
Updated on 15-Jun-2023 17:03:32

724 Views

In Swift, a string is a sequence of characters. So a string can contain small and larger words. Hence using the following methods we can find the largest word in the string. Using component() method Using user-defined method Example Input String: "Rabbit run fast" Output String: "Rabbit" Here, the largest word among all the given words in the string is “Rabbit”. Method 1: Using component() method The components() method is used to create an array of substrings from the given string, where each substring is separated by the specified separator. So here we use the components(separatedBy:.whitespaces) method ... Read More

Swift program to Convert Fahrenheit to Celsius

Ankita Saini
Updated on 16-Jun-2023 11:23:45

847 Views

Fahrenheit is the commonly used temperature-measuring unit. In this scale, the freezing point and boiling point of the water are 32 degrees and 212 degrees. Whereas Celsius is also a temperature-measuring scale. In the Celsius scale, the freezing point and the boiling point of the water are 0 degrees and 100 degrees. So in Swift, we can convert Fahrenheit to Celsius using the following methods − Using Formula Using converted() method Method 1: Using Formula We can easily convert Fahrenheit to Celsius using the mathematical formula. It is the easiest way to convert Fahrenheit to Celsius. ... Read More

Swift program to Convert Celsius to Fahrenheit

Ankita Saini
Updated on 16-Jun-2023 11:31:14

1K+ Views

Fahrenheit is the commonly used temperature-measuring unit. In this scale, the freezing point and boiling point of the water are 32 degrees and 212 degrees. Whereas Celsius is also a temperature-measuring scale. In the Celsius scale, the freezing point and the boiling point of the water are 0 degrees and 100 degrees. So in Swift, we can convert Celsius to Fahrenheit using the following methods − Using Formula Using converted() method Method 1: Using Formula We can easily convert Celsius to Fahrenheit using the mathematical formula. It is the easiest way to convert Celsius to Fahrenheit. Syntax ... Read More

Advertisements