Server Side Programming Articles

Page 1546 of 2109

Golang program to implement a persistent data structure (a stack)

Akhil Sharma
Akhil Sharma
Updated on 18-Oct-2023 458 Views

Persistent data structures, such as a stack, are of pivotal significance to programming for organising and chronologically managing data efficiently. This article showcases different examples to implement a persistent data structure in go, focusing on stack. In the first example we use immutable slices to perform the operation, while the second method employs a linked list, here implementation means we are going to demonstrate the operations like insertion, updation and deletion on a persistent data structure. Explanation A persistent data structure allows preserving previous versions when modifications are to occur. In this context, a stack as a data structure ...

Read More

Golang program to implement a concurrent hash map

Akhil Sharma
Akhil Sharma
Updated on 18-Oct-2023 814 Views

Concurrent hash maps can be perceived as efficient data structures for ensuring smooth and parallel execution. Designed to handle concurrent read and write operations efficiently, it is a valuable tool for building highly performant multi-threaded applications. In this article, we learn to implement a concurrent hash map in go. Syntax func NewConcurrentMap(size int) *ConcurrentMap The syntax defines a function named NewConcurrentMap defined to create and return an instance of a customized concurrent hash map named ConcurrentMap. Taking a size parameter to determine internal bucket count for data distribution, it encapsulates the initialization process. Algorithm Start by ...

Read More

Golang program to implement a Merkle tree

Akhil Sharma
Akhil Sharma
Updated on 18-Oct-2023 764 Views

A merkle tree is used in cryptography and computer science to verify the authenticity of a data efficiently. Merkle trees are extremely crucial in the fields of cryptography and blockchain technology for ensuring data integrity and security. In this article, we will learn the significance of Merkle trees and to implement a merkle tree in go. Here we are going to use two different examples to perform this implementation in the first example we will build the Merkle tree recursively through the `MerkleNode` struct with hash, left, and right pointer, and in the second example we will employ an ...

Read More

Golang program to implement a Bloom filter

Akhil Sharma
Akhil Sharma
Updated on 18-Oct-2023 373 Views

Bloom filters are a space-efficient data structure that find widespread use in various applications involving membership testing. In this article, we are going to explore how to create a Bloom filter in golanguage. Here we are going to write two different examples for this implementation, the first example includes the use hash functions from the FNV-1a algorithm, and in the second example we are going to use a a []bool array in order to determine element presence efficiently. Explanation A Bloom filter can be described as a probabilistic data structure that checks for the existence of an element in a ...

Read More

Golang program to find the cross product of two vectors

Akhil Sharma
Akhil Sharma
Updated on 18-Oct-2023 387 Views

The cross product is an operation performed on two vectors in three-dimensional space that results in a third vector that is orthogonal (perpendicular) to the original vectors. In this article, we will see the Golang program to find the cross product of two vectors, here we will explore two different methods. Explanation Let us assume we have two vectors A and B. The cross product of the two vectors can be calculated by the formula: C = A X B. Components of a cross product vector can be calculated by formula: Cx =Ay ⋅Bz −Az ⋅By Cy ...

Read More

Golang program to find the dot product of two vectors

Akhil Sharma
Akhil Sharma
Updated on 18-Oct-2023 705 Views

The dot product is a measure of how closely two vectors are aligning in the direction that they are pointing towards. The dot product of two vectors is a fundamental operation in linear algebra that calculates the sum of the products of corresponding elements in two vectors. In this article, we will write a Golang program to find the dot product of two vectors using a loop as well as using the go languages range keyword. Explanation The dot product of two vector is calculated by the formula shown below: DOT PRODUCT = A⋅B =Ax ⋅Bx +Ay ⋅By +Az ...

Read More

How to Scale Pandas DataFrame Columns?

Rohan Singh
Rohan Singh
Updated on 13-Oct-2023 5K+ Views

Scaling is the process of preprocessing the data in data analysis and ensuring that all the features in a dataset have similar ranges, making them more comparable and reducing the impact of different scales on machine learning algorithms. We can scale Pandas dataframe columns using methods like Min-max scaling, standardization, Robust scaling, and log transformation. In this article we will dive into the process of scaling pandas dataframe scaling using various methods. Why Scaling is Important? Some features in the data may have larger values which can dominate when the analysis or model training is done. Scaling ensures ...

Read More

Traning neural networks with vallidation using pytorch

Bhavani Vangipurapu
Bhavani Vangipurapu
Updated on 11-Oct-2023 283 Views

Introduction When training a neural network in deep learning, it is important to choose the right architecture and hyperparameters. Evaluating the network's performance on unseen data during training is crucial. PyTorch provides tools for creating and training neural networks in Python. To evaluate the neural network's testing accuracy, a validation set can be introduced. Installing PyTorch Let's ensure that we have the necessary dependencies installed before training neural networks in PyTorch. Using pip or conda, PyTorch can be installed. For computer vision tasks, run the following commands to install PyTorch along with the torchvision library: "pip install torch torchvision" ...

Read More

Cliques In Graph

Satadru Jati
Satadru Jati
Updated on 09-Oct-2023 4K+ Views

Recently, graph-based representations have gained enormous popularity for simulating real-world data. Cliques are a key issue in graph theory that is used to solve numerous mathematical issues and create graphs. Cliques are extensively researched in the field of computer science, with the clique problem assessing if a clique having a certain size within a graph is NP-complete.  Yet, in spite of all complexities, there has been research into several techniques for finding cliques. What Are Cliques? In all undirected graphs G = (N, E), a clique, is a "subset of the nodes", so that all pairs of distinct nodes is ...

Read More

Applications, Advantages and Disadvantages of Unweighted Graph

Satadru Jati
Satadru Jati
Updated on 09-Oct-2023 762 Views

How Do Graphs Work? A group of things that are connected is referred to as a graph. They may represent anything at all, from based on merely mathematical ideas, to real-life objects, events and occurrences. For instance, a graph represents a list of individuals with a family connection. Similarly, a network of metropolitan areas is linked together by roadways. Typically, we describe the elements of the network as nodes or vertices, while the links among them are referred to as edges or arcs. Pic 1 − Visual Representation of a Graph with Nodes and Edges Unweighted Graph: What Is ...

Read More
Showing 15451–15460 of 21,090 articles
Advertisements