Found 26504 Articles for Server Side Programming

How to add a method to struct type in Golang?

Siva Sai
Updated on 20-Apr-2023 09:51:00

4K+ Views

In Golang, structs are an essential part of the language and are used to define complex data types. Often, you may find yourself in a situation where you need to add a method to a struct to perform some specific action. In this article, we will discuss how to add a method to a struct type in Golang and provide some examples to help you understand the concept. Defining a Struct in Golang Before we dive into adding methods to a struct, let's first understand how to define a struct in Golang. A struct is a composite data type that ... Read More

How to Access Interface Fields in Golang?

Siva Sai
Updated on 20-Apr-2023 09:49:38

6K+ Views

As a popular programming language, Golang is used in many applications and frameworks due to its high performance and easy-to-use syntax. If you are working with interfaces in Golang, you may need to access the fields of the interface to retrieve or manipulate data. In this article, we will discuss how to access interface fields in Golang and provide some examples to help you understand the concept. Understanding Interfaces in Golang Before we dive into accessing interface fields, let's first understand what interfaces are in Golang. An interface is a set of method signatures that define a behavior. In other ... Read More

Isomorphism in N-ary Trees

Tapas Kumar Ghosh
Updated on 20-Apr-2023 12:42:19

510 Views

Isomorphism is defined as two trees either having identical or mirror structures. In the case of mirror structure, the left node data will always match the right node. For example, we will take a number nearest to the mirror and see what its reverse would be, that is the real concept of isomorphism. In this article, we are going to check whether two different binary trees are isomorphic or not. Let’s take an example of Isomorphism in N-ary Trees − Note that, L represents as left node whereas R represents as Right node Mirror structure of P and Q ... Read More

Check score of given binary string

Tapas Kumar Ghosh
Updated on 20-Apr-2023 12:25:58

305 Views

The sequence of bytes is called a binary string and it holds the binary value. A binary score is normally presented on a range from 0 to 1 where 1 is reserved for the perfect model. In the given binary string, If the element is found to be 1 then it will calculate as the score and increment the count sum. Let’s take an example of a binary score − The given binary string is 1011010. In the above figure, the number 1 is present in the index- 0, 2, 3, and 5. Therefore, the total score is 4 ... Read More

Length of longest substring that do not contain any palindrome

Tapas Kumar Ghosh
Updated on 20-Apr-2023 12:22:04

366 Views

In C++, we have predefined function max() that will be used for finding any longest substring that does contain any palindrome. A palindrome string is a group of characters that remains the same even after reversing. Let’s take an example of a palindrome string to make the longest non-palindrome substring. The string malayalam itself is a palindrome but we need to identify the longest non-palindrome substring. When we change the string malayalam( length=9 ) to alayalam then we get the longest non-palindrome substring length i.e, 8. The string synapse is a non-palindrome string and its length is 7. ... Read More

Check if string can be made lexicographically smaller by reversing any substring

Tapas Kumar Ghosh
Updated on 20-Apr-2023 12:17:45

704 Views

In C++ we have an inbuild reverse() function that will be used for reversing the substring to check whether a string can be made lexicographically smaller or not. Lexicographic ordering is the process by which the character of a word is sorted in a dictionary. Let’s take an example of a string to check lexicographically smaller or not. We will compare the two words to check the lexicographically smaller ones and take two strings namely ‘apple’ and ‘army’. Both these strings of the first letter starting with letter ‘a’. When we move to check the second character of both ... Read More

Replace every consonant sequence with its length in the given string

Tapas Kumar Ghosh
Updated on 20-Apr-2023 12:14:08

403 Views

This article will help us understand how to replace the consecutive consonant sequence with its length in the given string. Consonants are series of alphabetical letters that are not vowels. Here we need to first identify which letter in the string are consonants. For example, in the word “abcdiopqrsu”, the consonant sequence “bcd” and “pqrs”. Next, we would replace each consonant sequence with its length. So the word “bcd” would replace with “3” because there are three consecutive consonants, and the same with the word “pqrs” replace with “4” as there are four consecutive consonants. Algorithm First, we ... Read More

How to style a select dropdown with only CSS?

Tapas Kumar Ghosh
Updated on 10-May-2023 11:13:20

246 Views

The website navigation plays an important role while building the website because it contains the dropdown list. The collection of various lists that exists in one or more navigation is called a dropdown list. To create the dropdown list it needs the select and option element. The option element is used under the select element which collects the list of various types like products, subjects, courses, etc. In this article, we are going to design the select dropdown with only CSS. Syntax option1 option1 The select element is used to ... Read More

Creating a Dataframe from Pandas series

Tamoghna Das
Updated on 20-Apr-2023 15:36:40

3K+ Views

In data science, data is represented in various formats, such as tables, graphs, or any other types of structures. One of the most common data structures used to represent data is a DataFrame, which can be created using an array or a series. In this document, we will discuss how to create DataFrames from a Pandas Series object. Importance of Dataframe in data science! Dataframe is a two-dimensional table-like data structure that is widely used in data science. It is a very important tool for data manipulation, data analysis, and data visualization. Here are some of the key advantages of ... Read More

Create a GUI to Get Sunset and Sunrise Time using Python

Tamoghna Das
Updated on 20-Apr-2023 11:38:11

591 Views

What is Python and what are its advantages? Python is a high-level programming language that is used for a wide range of applications, including web development, scientific computing, data analysis, and artificial intelligence. It has a simple and elegant syntax that makes it easy to read and write, and a large standard library that provides many useful tools and functions. Some of the advantages of Python include its readability, ease of use, flexibility, and portability. It is an open-source language, which means that it is freely available and can be modified and distributed by anyone. Python also has a large ... Read More

Advertisements