Split Array into Equal Sum Parts in C++

Arnab Chakraborty
Updated on 17-Oct-2019 13:36:42

877 Views

Here we will see one problem. Suppose one array arr is given. We have to check whether the array can be split into two parts, such that −Sub of both sub-arrays will be the sameAll elements, which are multiple of 5, will be in the same groupAll elements which are multiple of 3, but not multiple of 5, will be in the same groupAll other elements will be in other groups.Suppose the array elements are {1, 4, 3}, then this can be split, because the sum of {1, 3} is the same as the sum of {4}, and the groups ... Read More

Run Python Code on Google Colaboratory

Pradeep Elance
Updated on 17-Oct-2019 13:25:07

868 Views

Google Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud. It is hosted in google cloud and maintained by Google for the benefit of python coders who want to run and test python scripts using a cloud environment. In this article, we will see how to set up and run a google collaboratory cloud environment.Opening the Python NotebookWe navigate to this google link (https://colab.research.google.com/). It opens up the below screen. We choose the option NEW PYTHON3 NOTEBOOK from the bottom right corner as shown in the diagram below.Python CodeOptionsOn clicking the NEW ... Read More

Get Password and Username in Python Without Echo

Pradeep Elance
Updated on 17-Oct-2019 12:53:09

2K+ Views

When you create some python programs that need password protection before it can run, we take the help of the getpass() and getuser() modules. They have a variety of functionalities that can be used to manage password protection as well as password retrieval etc. In this article, we will see how to type in the password with and without echoing it back on the screen. Below are the different ways it is handled.With PromptThe below code is saved to a file (logon.py). The getpass() function prints a prompt then reads input from the user until they press returnExample Live Demoimport getpass ... Read More

Common Mistakes When Using Python Dictionary

Pradeep Elance
Updated on 17-Oct-2019 12:41:09

306 Views

Dictionaries in python are a type of data structure that map keys to values as a key-value pair. They are one of the frequently used data structures and have many interesting properties. They are presented by enclosing them in a pair of curly brace like below.dict = {'day1':'Mon' ,'day2':'Tue', 'day3':'Wed'}The elements or key-value pairs in the dictionary are represented within single quotes and separated by a colon.Creating a DictionaryWe create a dictionary by assigning values written in the form of a ke.ExampleDict1 = {'day1':'Mon' ,'day2':'Tue', 'day3':'Wed'} print(type(dict1)) print(dict1) # Using the dict() method dict2 =dict({('day1', 'Mon'), ('day2', 'Tue'), ('day3', ... Read More

Datagram in Python

Pradeep Elance
Updated on 17-Oct-2019 12:24:35

662 Views

Chunks of data move between the clients and servers using the User Datagram Protocol or UDP protocol. The two communicating endpoints need the IP address and port number to establish communication. One endpoint is known as the sender and the other is known as the receiver. In this protocol, the sender does not keep track of the sent packets and it is up to the receiver to accept or not all the packets.Sender ProgramThe below python program uses the socket module to create the sender’s program. We declare variables for IP address and Port. Then add a message to it. ... Read More

Colorsys Module in Python

Pradeep Elance
Updated on 17-Oct-2019 12:07:25

1K+ Views

This module allows bidirectional conversions of color values between colors expressed in the RGB (Red Green Blue) and other color spaces. The three other color spaces it uses are YIQ (Luminance (Y) In-phase Quadrature), HLS (Hue Lightness Saturation) and HSV (Hue Saturation Value). All the coordinates can be between 0 and 1 except the I and Q values in the YIQ color space.The below tables shows the functions and their purpose.FunctionPurposePermitted Valuesrgb_to_yiqfrom RGB coordinates to YIQ coordinates0 to 1rgb_to_hlsfrom RGB coordinates to HLS coordinates0 to 1rgb_to_hsvfrom RGB coordinates to HSV coordinates0 to 1yiq_to_rgbfrom YIQ coordinates to RGB coordinates-1 to 1hls_to_rgbfrom ... Read More

Join Several Partitions on Linux

Samual Sam
Updated on 17-Oct-2019 11:55:43

535 Views

In this article, we will create a single partition on Linux using 2 drives of 20 GB each to make a 40 GB single mount point so that we can store the data in one place with more space on the volume. Here, we are using a package called ‘mhddfs‘ which is a driver for Linux that combines several mount points into a virtual disk. This is a fuse based driver which provides an easy solution for large data storage that combines many small file systems into a single big virtual file system.Features of MhddfsWe can get System information and ... Read More

Jawbone UP3 vs Fitbit Charge HR

Samual Sam
Updated on 17-Oct-2019 11:55:21

174 Views

Jawbone and Fitbit are the two popular companies that design and develop awesome fitness trackers. More often than not, the products developed by these two companies have the tinge of perfection and look as immaculate as they should be. Having said that, the fitness tracker of Jawbone is the attention grabber and self-proclaimed “world’s most advanced tracker” called UP3. In the case of Fitbit, it is the cynosure of all eyes which is rightly called Charge HR. Approach any individual with average technical acumen, and ask him about the best fitness trackers, he would name either Jawbone UP3 or Fitbit ... Read More

Process Communication in Operating System

Arnab Chakraborty
Updated on 17-Oct-2019 11:27:36

6K+ Views

Processes that executing concurrently in the operating system may be either independent processes or cooperating processes. if a process cannot affect or be affected by the other processes executing in the system then the process is said to be independent. So any process that does not share any data with any other process is independent. A process is said to be cooperating if it can affect or be affected by the other processes executing in the system. So it is clear that, any process which shares its data with other processes is a cooperating process.There are many reasons for providing ... Read More

Program Execution in CPU

Arnab Chakraborty
Updated on 17-Oct-2019 11:19:43

2K+ Views

One may be amazed how the CPU is programmed. A special register is contained in CPU-the instruction register-whose bit pattern determines what the CPU will do. Once that action has been completed, the bit pattern in the instruction register can be changed, and the CPU will perform the operation specified by this next bit pattern.Most of the modern CPUs use an instruction queue. Some instructions are waiting in the queue, ready to be executed. Different electronic circuitry keeps the instruction queue full while the control unit is executing the instructions. But this is simply an implementation details that allows the ... Read More

Advertisements