Linux ps Command

Pradeep Jhuriya
Updated on 19-Apr-2023 11:12:26

10K+ Views

Introduction The ps command is a widely used utility in Linux that provides a snapshot of current processes and their status. It helps monitor running processes, identify process ID (PID), terminal type (TTY), CPU time usage, command name, user ID and other information. This article provides a comprehensive overview of the various use cases of the ps command in real life. Syntax of ps Command The basic syntax of the ps command is as follows − $ ps [OPTIONS] The ps command supports three different syntax styles: Unix, BSD, and GNU. Unix-style syntax can be wrapped and preceded by ... Read More

Find and Replace Text in a File on Linux

Pradeep Jhuriya
Updated on 19-Apr-2023 11:09:00

25K+ Views

Introduction In Linux-based operating systems, there are many ways to search (find) and replace text in a file. Depending on the size of a file and the complexity of the find and replace operation, different tools and commands may be more appropriate. In this article, we'll learn a few different methods of finding and replacing text in Linux environments. Using the sed command to find and replace text The sed (stream editor) command line tool is another powerful tool that can be used to find and replace text in files on Linux. This tool is often used to perform more ... Read More

Palindromic Selfie Numbers

Vanshika Sood
Updated on 19-Apr-2023 11:08:35

338 Views

A number is considered to be a “Selfie Number” if it can be represented using only its own digits and certain mathematical operations. For example, 936 is a selfie number. $$\mathrm{936\:=\:(\sqrt{9})!^{3} \:+\:6!\:=\:216\:+\:720\:=\:936}$$ Here it can be observed that a series of operations are performed on the digits of the original number and the resultant is equal to the original number. Palindromic Selfie Numbers are a special kind of selfie number. They satisfy the selfie multiplicative rule. Consider a number x. Let the number formed by reversing the digits of x be $\mathrm{x^\prime}$. Let y be a ... Read More

Closest Numbers from a List of Unsorted Integers

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

1K+ Views

In the following article, we discuss two approaches to find the closest numbers from a list of unsorted integers. Let us first understand what is meant by the term ‘closest numbers’. Closest numbers are the pair(s) of numbers which have the least difference between them. Problem Statement Given a list of distinct unsorted integers, we need to find the pair of elements that have the least difference between them. If there are multiple pairs, we need to find all of them. Furthermore, in the article wherever there is a mention of difference, it means absolute difference. Examples Input: [44, 42, ... Read More

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

832 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

139 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

Advertisements