Problem statementGiven an Array of non-negative integers. Find out three elements from the array which form a triangle of maximum perimeterExampleIf input array is {5, 1, 3, 5, 7, 4} then maximum perimeter is (7 + 5 + 5) = 17AlgorithmSort the array in non-increasing order. So, the first element will be maximum and the last will be minimumIf the first 3 elements of this sorted array forms a triangle, then it will be the maximum perimeter triangleExample Live Demo#include using namespace std; int getMaxPerimeter(int *arr, int n) { sort(arr, arr + n, greater()); int maxPerimeter = 0; ... Read More
In this article, we will learn how to enable or add the swap partition on Ubuntu 16.04, actually, the swap will increase the chance of responsiveness of the servers by guarding the out of memory errors for the applications, by default Ubuntu will not enable the swap space. We will learn how to add or enable the swap file for Ubuntu 16.04 servers.Swap is the location or the file which can handle the temporary data which is not required immediately by RAM but will be used to increase the amount of information that the server can handle for its working ... Read More
In this article we shall try to learn, how to add EPEL Repository for Linux. EPEL (Extra Package for Enterprise Linux) is an open source and free community based repository from the Fedora community team which provides high quality and good add-on software’s for Linux distributions. It has Red Hat Enter Linux, CentOS, Scientific Linux and most of the repositories which are maintained by the Fedora team only.Why we use EPEL Repositories for PackagesProvides a lot of open source packages which are installed using yum.EPEL repositories are open source and they are 100% free to use.There will not be any ... Read More
Isn’t it difficult to tackle certain situations when one wrong step can change the entire consequences? Yes, some situations make us dumbfound, and paralyze our decision-making capabilities whether that has a positive or negative impact on our project’s life. So, don’t you think that it is better to have some tools and techniques to deal with such threats and opportunities?Irrespective of the project’s duration and intricacy, risks are always there and in the case of long-term complex projects, the level of risks increases manifolds. So, to minimize the negative impact on our projects, we should have a concrete plan with ... Read More
Last week, while discussing with my colleagues on various topics, the discussions took an unexpected turn and reached to one of the trending topic called ‘Employee Attrition’. Frankly saying it was not unexpected, actually for the last couple of months we have been seeing many ‘good-bye’ or ‘keep in touch’ kind of parting emails almost twice or thrice in a week. Everybody is discussing on it, whether it is during lunch time or coffee breaks, the gossip and rumors are in the air!These type of discussions are not only restricted to one company. Actually, you can see such trends in ... Read More
This article helps you to create and add a new virtual disk to an existing Linux virtual machine on VMware. Here are some steps for adding a new SCSI based virtual disk on a CentOS Linux virtual machine. We are assuming that you are already familiar with Linux system administration skills and having knowledge of vCenter Server or vSphere Client. For a full description of the utilities mentioned in this article, please refer to the manuals.SolutionTo add a new virtual disk for an existing Linux virtual machine, Log in as root on your Linux virtual machine. Run this below command ... Read More
In this article, we will learn how to create a RAID 5 Array configuration using the ‘mdadm’ utility.The ‘mdadm’ is a utility which is used to create and manage storage arrays on Linux with RAID capability where the administrators are having great flexibility in managing the individual storages devices and creating the logical storage with a high performance and redundancy.RAID 5 Array is a type where we implement by striping the data across the total available devices. Every component of the each stripe is calculated by parity block. If any device fails the parity block, it will use the remaining ... Read More
In this article, we will learn how to create a RAID 0 Array configuration using the ‘mdadm’ utility.The ‘mdadm’ is a utility which is used to create and manage storage arrays on Linux with RAID capability where the administrators are having a great flexibility in managing the individual storage devices and creating the logical storage with a high performance and redundancy.RAID 0 array will work by dividing the data into small chunks and strips that data across the available storage disks, which means that each and every storage disk will contain a portion of data and when retrieving the data ... Read More
In this article, we will teach you on – how to schedule a corn job to execute at a specific time.General Syntax of a Cron JobMIN HOUR Day of month Month Day of Week Command 0-59 0-23 1-31 1-12 0-6 linux command or scriptTo see a list of Cron Jobs which exists on the machine, run the below command –# crontab -l no crontab for rootTo add the new cron job, run the below command –#crontab -e no crontab for root - using an empty one Select an editor. To change later, run 'select-editor'. 1. /bin/ed 2. /bin/nano
In multithreading environment, two or more threads can access the shared resources simultaneously which can lead the inconsistent behavior of the system. Java uses concept of locks to restrict concurrent access of shared resources or objects. Locks can be applied at two levels −Object Level Locks − It can be used when you want non-static method or non-static block of the code should be accessed by only one thread.Class Level locks − It can be used when we want to prevent multiple threads to enter the synchronized block in any of all available instances on runtime. It should always be used ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP