Sort Array of Strings by Another String in C++

Arnab Chakraborty
Updated on 21-Oct-2019 12:18:01

420 Views

Suppose we have an array of strings, and another string is there for the reference. We have to take the reference string and using the order of the characters in the reference string we will sort the string array. Here we are considering the strings in the array, and the reference string is in lower case letters.Suppose the string array is like: [“hello”, “programming”, “science”, “computer”, “india”], the reference string is like: “pigvxbskyhqzelutoacfjrndmw”, After sorting the output string will be like [“programming”, “india”, “science”, “hello”, “computer”]The task is simple. We have to traverse the reference string, then store the character ... Read More

Sort Elements of Array Between Multiples of K in C++

Arnab Chakraborty
Updated on 21-Oct-2019 12:15:15

193 Views

Suppose we have an array A, and another integer K. We have to sort the elements that are in between any two multiples of K. Suppose A is like [2, 13, 3, 1, 21, 7, 8, 13, 12], and K = 2. The output will be [2, 1, 3, 7, 13, 21, 8, 13, 12]. Here multiple of 2 are 2, 8 and 12, the elements in between 2 and 8 are 13, 3, 1, 21, 7, they will be sorted as 1, 3, 7, 13, 21, the elements between 8 and 12 is only 13, so that is already ... Read More

Best Presentation Tools for Business

Samual Sam
Updated on 21-Oct-2019 12:14:48

294 Views

It is not uncommon to see many people trying their hands at tools such as PowerPoint and Prezi to deliver everlasting presentations. More often than not, they end up whacking their brains to make their presentations all the more impressive.Call it an all-consuming obsession of a connoisseur, PowerPoint and Prezi no longer holds candle to the several viable alternatives available in the market. There are several new kids on the block. One should definitely give a shot to each of the below mentioned alternatives. Here is a comprehensive and a curated list on the best Prezi alternative tools −EmazeLet me ... Read More

Prevent Fork Bomb by Limiting User Processes in Linux

Samual Sam
Updated on 21-Oct-2019 12:11:38

409 Views

A Fork Bomb is a denial-of-service (DoS) attack against a Linux based system. It makes use of the fork operation to create infinite processes and is called as “Rabbit Virus or wabbit”. The system process continually replicates itself to deplete available system resources, causing resource starvation, slowing or crashing the system. This article gives insights on – how to prevent a fork bomb attack in Linux system.Fork Bomb uses a bash code and gets executed repeatedly. Linux system admin often uses bash function to test the user process limitations and this specific process can be configured in /etc/security/limits.conf file. Once Fork ... Read More

Monitor Linux Server Performance Remotely Using Web Browser

Samual Sam
Updated on 21-Oct-2019 12:07:49

440 Views

Are you looking for speedy server statistics monitoring script? If yes, then this article is for you. Here, we will be explaining about Linux-dash which is a memory efficient, low resource, easy to install, server statistics monitoring script written in PHP.An internet static web page allows you to rearrange various widgets as you want. This script displays residing records of your server, including RAM, CPU, Disk space, community understanding, mounted programs, going for walks approaches and rather more.Linux Dash FeaturesLinux Dash Features should be like this –It is a lightweight and responsive web-based interface for monitoring server resourcesEasy to install ... Read More

Check If a Number is Divisible by Any of Its Digits in C

Sunidhi Bansal
Updated on 21-Oct-2019 11:59:18

2K+ Views

Given a number n, task is to find that any of the digit in the number divides the number completely or not. Like we are given a number 128625 is divisible by 5 which is also present in the number.ExampleInput: 53142 Output: yes Explanation: This number is divisible by 1, 2 and 3 which are the digits of the number Input: 223 Output: No Explanation: The number is not divisible by either 2 or 3The approach used below is as follows −We will start from the unit place and take the unit place’s number.Check whether the number is divisible or ... Read More

C Program for Product of Array

Sunidhi Bansal
Updated on 21-Oct-2019 11:53:57

10K+ Views

Given an array arr[n] of n number of elements, the task is to find the product of all the elements of that array.Like we have an array arr[7] of 7 elements so its product will be likeExampleInput: arr[] = { 10, 20, 3, 4, 8 } Output: 19200 Explanation: 10 x 20 x 3 x 4 x 8 = 19200 Input: arr[] = { 1, 2, 3, 4, 3, 2, 1 } Output: 144The approach used below is as follows −Take array input.Find its size.Iterate the array and Multiply each element of that arrayShow resultAlgorithmStart In function int prod_mat(int arr[], ... Read More

C Program for Arrow Star Pattern

Sunidhi Bansal
Updated on 21-Oct-2019 11:49:31

2K+ Views

Given a number n and we have to print the arrow star pattern of maximum n number of stars.The star pattern of input 4 will look like −ExampleInput: 3 Output:Input: 5 Output:The approach used below is as follows −Take input in integer.Then print n spaces and n stars.Decrement till n>1.Now increment till n.And print spaces and stars in increasing order.AlgorithmStart In function int arrow(int num)    Step 1-> declare and initialize i, j    Step 2-> Loop For i = 1 and i

Create Beautiful and Useful Infographics

Samual Sam
Updated on 21-Oct-2019 11:47:53

248 Views

We all know the old saying – A picture is worth a thousand words referring to the idea that, complex topics can be conveyed with just a single image. Since, it is widely believed that, essence and meaning of content can be explained better through visual mode in a better way. Also, it is fun to look at pleasant pictures or watching cool videos than to read normal text.In advertising and media industry, It is also a proven fact that, visual content drives more traffic and engagement than text does. Trying a cool infographic is the new trend. This article ... Read More

Add User to the Group on Linux

Samual Sam
Updated on 21-Oct-2019 11:44:54

1K+ Views

The concept of “group” may be confusing to many Linux users. Linux operating system is designed to allow more than one user to have access to the Linux system at a time. Linux/Unix operating systems provides multitasking abilities to its multi-users. In order to do this task, we need to assign a group to each Linux user. This article gives step by step process on – how to add a user to the group in Linux system.Create a New UserTo create a new user using Linux command line, use the following command –$ sudo useradd tutorialspointThe above command is used ... Read More

Advertisements