Delete a Linked List Using Recursion

Vanshika Sood
Updated on 19-Apr-2023 11:04:06

1K+ Views

Linked List A linked list is a linear data structure in which the elements are stored at non-contiguous memory locations. Each element consists of a node. A node is composed of a data field, which holds the value of the element, and an address field, which points to the location of the next node in the series. The first node of the linked list is referred to as the ‘head’ of the list. The last element of the linked list can be defined as the element which points to NULL. A diagrammatic representation of a linked list is shown below. ... Read More

Check If a Number Is a Munchhausen Number

Vanshika Sood
Updated on 19-Apr-2023 11:02:04

808 Views

Munchhausen Numbers are peculiar numbers which possess a unique property. A number is considered to be munchhausen if the sum of the digits of the number, raised to their own power, is equal to the original number. These numbers are uncommon and not many of them are known. If the definition 00 = 0 is used, then 0 can also be considered a munchhausen number. The following article provides a method to determine whether a number is munchhausen or not while keeping in mind these characteristics of munchhausen numbers. Problem Statement The task at hand is to check whether a ... Read More

Addition of Two N-bit Binary Numbers

Manish Kumar Saini
Updated on 19-Apr-2023 10:58:02

2K+ Views

In digital electronics and digital systems such as digital computers, calculator, etc., the binary numbers and their arithmetic operations play a vital role. Just like the decimal number system, we can perform all the four basic arithmetic operations, i.e. addition, subtraction, multiplication, and division of binary numbers as well. Read this article to learn how you can add two n-bit binary numbers. What is Binary Addition? Binary addition is a basic arithmetic operation performed on binary numbers in which two binary number of any digit are added to obtain a sum. As we know, a binary number system has base ... Read More

6 Variable K-Map in Digital Electronics

Manish Kumar Saini
Updated on 19-Apr-2023 10:45:01

5K+ Views

Read this article to learn how you can use the K-Map (Karnaugh Map) to reduce a Boolean function in six variables. Let's start with a brief introduction to Karnaugh Map (K-Map). Karnaugh Map (K-Map) The Karnaugh Map or K-Map is a graphical method of reducing a Boolean function to its minimal form. The K-Map can be defined as a chart or a graph that is composed of an arrangement of adjacent squares or cells, where each cell represents a particular combination of variables of the Boolean expression either in sum or product form. A typical 2 Variable K-Map is represented ... Read More

Split Slice After Specified Separator in Golang

Siva Sai
Updated on 19-Apr-2023 10:12:29

129 Views

In Golang, there are multiple ways to split a slice after a specified separator. This can be achieved using built-in functions and methods. In this article, we will explore some of the common ways to split a slice in Golang. Using strings.SplitAfter Function The strings package in Golang provides a SplitAfter function, which splits a string or slice of bytes after the specified separator and returns the result as a slice of strings Example package main import ( "fmt" "strings" ) func main() { slice := []string{"apple_", "banana_", "cherry_", ... Read More

Split String After Specified Separator in Golang

Siva Sai
Updated on 19-Apr-2023 10:10:34

2K+ Views

Splitting a string after a specified separator is a common operation in many programming languages, including Golang. In Golang, the strings package provides several functions to split a string after a specified separator. In this article, we will discuss how to split a string after a specified separator in Golang. Using strings.SplitAfter() The strings.SplitAfter() function is used to split a string after a specified separator. It takes two arguments: the string to be split and the separator after which to split the string. The function returns a slice of strings. Example Here's an example code that demonstrates how to use ... Read More

Split Slice by Specified Expression in Golang

Siva Sai
Updated on 19-Apr-2023 10:08:15

176 Views

In Golang, slices are used to store sequences of elements of the same type. Slicing a slice is a common operation in Golang, but sometimes we need to split a slice based on a specified separator. Golang provides a built-in function to split a string based on a separator, but splitting a slice is a bit different. In this article, we will explore how to split a slice separated by the specified expression in Golang. Using the Strings Package The strings package in Golang provides the Split() function, which is used to split a string into a slice based on ... Read More

Compare Two Slices of Bytes in Golang

Siva Sai
Updated on 19-Apr-2023 10:06:56

2K+ Views

In Go, comparing two slices of bytes involves checking if each element in both slices is equal. This can be done using a loop or the built-in bytes.Equal() function. In this article, we'll explore both methods and see how to compare two slices of bytes in Go. Using a Loop To compare two slices of bytes using a loop, we can iterate over each element in both slices and check if they are equal. Here is an example − Example package main import ( "fmt" ) func main() { slice1 := []byte{0x01, ... Read More

Compare Times in Golang

Siva Sai
Updated on 19-Apr-2023 10:06:01

10K+ Views

In Golang, it's common to work with time-related operations, such as comparing times. Comparing times is essential when dealing with scheduling, deadlines, and many other scenarios. In this article, we'll explore how to compare times in Golang and provide you with a comprehensive guide. Golang Time Package Golang provides a built-in time package, which offers various functionalities related to date and time. To use this package, you'll need to import it in your code using the following syntax − import "time" The time package provides a Time type that represents a specific time. You can create a Time value ... Read More

Compare Structs with Different Values in Golang

Siva Sai
Updated on 19-Apr-2023 10:03:56

447 Views

When working with Go, it's often necessary to compare structs to determine whether they're equal or not. Comparing two structs can be easy when they have the same values assigned to their data fields. However, comparing structs with different values assigned to their data fields can be a bit more complicated. In this article, we'll discuss how to compare structs with different values assigned to their data fields in Golang. Comparing Structs with the Same Values Assigned to Data Fields Before we dive into comparing structs with different values assigned to their data fields, let's first take a look at ... Read More

Advertisements