Found 27104 Articles for Server Side Programming

Get the class name of an object as a string in Swift

Nitin Aggarwal
Updated on 07-Sep-2023 08:49:13

914 Views

This article will explain to you how to get the name of the class of an object in the Swift language. Swift provides us with a function called type(of:) to get the type of a value or the class name of an object. You can use the type(of:) function to find the dynamic type of a value, particularly when the dynamic type is different from the static type. The static type of a value is the known, compile-time type of the value. The dynamic type of a value is the value’s actual type at run-time, which can be a subtype ... Read More

Generate a UUID on iOS from Swift

Nitin Aggarwal
Updated on 06-Sep-2023 18:14:04

552 Views

This article will explain to you what is the UUID in iOS and how to generate it in the Swift language. You will see some practical situations in which UUID is useful in the iOS application. What is UUID? A universally unique identifier (UUID) is a string of characters that is guaranteed to be unique across all devices and at all times. UUIDs are often used to uniquely identify resources, such as database records or files. In iOS, UUIDs can be used for a variety of purposes. Some common use cases for UUIDs in iOS include − Identifying app-specific ... Read More

Golang program to implement a weighted interval scheduling algorithm

Akhil Sharma
Updated on 05-Sep-2023 19:03:01

120 Views

The Weighted Interval Scheduling Problem revolves around a set of intervals, each having an associated weight. In this article, we will implement the Weighted Interval Scheduling algorithm in go, using two methods: Recursive and Dynamic Programming. This classic optimization problem involves selecting non-overlapping intervals with maximum total weight. Explanation Recursive Method The Recursive Method takes a straightforward yet elegant approach. It examines each interval one by one and considers two scenarios − whether to include the current interval or skip it. This method utilises recursion to explore all possible combinations of intervals, calculating the maximum weight. While ... Read More

Golang program to implement a treap

Akhil Sharma
Updated on 05-Sep-2023 18:46:19

71 Views

In this article, we will explore the implementation of a Treap data structure in Golang using two different methods. A Treap is a combination of a binary search tree and a binary heap, making it an efficient data structure for maintaining a set of ordered elements while also ensuring balanced priority. The first method will utilise a recursive approach for building and maintaining the Treap, while the second method will implement an iterative approach. The examples below showcase the creation and traversal of a randomised binary search tree, Explanation A Treap is a cool combination of two other structures, a ... Read More

Golang program to implement a bitset

Akhil Sharma
Updated on 05-Sep-2023 18:08:26

178 Views

A BitSet is a data structure that represents a fixed-size set of binary values, where each value can be either 0 or 1. It is commonly used for efficiently storing and manipulating large sets of boolean values. In this article, we will implement a bitset in go, using two different methods, the first one involves the use of slice of booleans as well as the second one involves using bit manipulation with unsigned integers. Implementation here means that we are going to perform various operations like setting, clearing and testing of individual bits within a bitset data structure. Explanation ... Read More

Golang program to implement a trie with compressed nodes

Akhil Sharma
Updated on 05-Sep-2023 17:57:26

102 Views

Tries are tree-like data structures used for efficient storage and retrieval of strings, making them invaluable for tasks like autocomplete, dictionary implementation, and pattern matching. The compressed node technique optimises space usage by merging common prefixes among nodes, resulting in a more memory-efficient Trie. In this article, we will explore the implementation of a Trie with Compressed Nodes in Golang using two methods to implement the Trie with Compressed Nodes, the first method utilises maps, and the second method uses arrays. Explanation A compressed trie is a trie data structure that saves the space by combining consecutive nodes with ... Read More

Golang program to implement a double ended priority queue

Akhil Sharma
Updated on 05-Sep-2023 17:54:25

110 Views

A Double Ended Priority Queue, in short DEPQ is a data structure that extends the functionality of a standard priority queue. In this article, we will implement a double ended priority queue in Golang using two methods: the first method uses two separate heaps for maximum and minimum priorities, while the second method augments a single heap with additional information for efficient queries. In the code examples we are going to perform the operations like insertion retrieval, deletion and updation. Explanation Double ended priority queue is a data structure that allows insertion and deletion operations and it allows efficient ... Read More

Golang program to implement a hash table with linear probing

Akhil Sharma
Updated on 05-Sep-2023 17:44:25

342 Views

Hash tables are efficient data structures used to store key-value pairs, making them essential for various applications. Linear probing is a collision resolution technique that helps handle situations when two keys map to the same index in the hash table. In this article, we will explore the implementation of a Hash Table with Linear Probing in Golang, using arrays and maps, gaining insights into their workings and practical applications. In the below examples we are going to perform insertion and retrieval operations using a hash mechanism and collision resolution strategy. Explanation In the below example, keys [10 , 25, ... Read More

Golang program to implement a deque using doubly linked list

Akhil Sharma
Updated on 05-Sep-2023 17:39:12

197 Views

A deque is a versatile data structure that allows insertion and deletion of elements from both ends efficiently. The doubly linked list provides an excellent foundation for building a deque as it allows easy traversal in both directions. In this article, we will explore deque using doubly linked lists in go with two methods: using a custom doubly linked list and using the built-in container/list package in Golang. Here in the below examples we will showcase the operations of a double ended queue, we will perform the insertion and deletion operations at both the ends. Explanation As you can see ... Read More

Remove all duplicates and permutations in a nested list in Python

Pranavnath
Updated on 04-Sep-2023 16:43:51

641 Views

Removing duplicates and changes from a settled list in Python could be a common errand that makes a difference streamline information and maintain a strategic distance from excess or dreary components. In this article, we point to extricate an interesting set of sublists from the settled list, disposing of any duplicates or stages. By doing so, we will streamline further operations and guarantee information keenness. In this article, we are going investigate three diverse approaches to attain this objective. Each approach will go with step-by-step clarifications, Python code, and yield, empowering you to get it and execute the foremost reasonable ... Read More

Advertisements