Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Sunidhi Bansal
Page 57 of 81
Count set bits in an integer in C++
We are given an integer number let’s say, num and the task is to first calculate the binary digit of a number and then calculate the total set bits of a number. Set bits in a binary number are represented by 1. Whenever we calculate the binary number of an integer value then it is formed as the combination of 0’s and 1’s. So, the digit 1 is known as a set bit in terms of the computer. Example 1 Input − int number = 50 Output − The count ...
Read MoreProgram for Point of Intersection of Two Lines in C++
Given points A and B corresponding to line AB and points P and Q corresponding to line PQ; the task is to find the point of intersection between these two lines. Note − The points are given in 2D plane on X and Y coordinates. Here A(a1, a2), B(b1, b2) and C(c1, c2), D(d1, d2) are the coordinates which are forming two distinct lines and P(p1, p2) is the point of intersection. (just for a diagrammatic explanation of the point of intersection) How to find the point of intersection − Let’s take the above figure as − Example So ...
Read MoreJava program to convert Byte array to IP Address
In this article, we will learn to convert a byte array into an IP address using the IPAddress class in Java. This program takes a series of bytes, representing an IP address in binary form, and converts them into a standard dot-separated string representation of an IP address. We'll go through the simple steps of declaring a byte array and then converting it into a readable IP address format. What is a Byte Array? A byte comprises 8 bits and a byte array comprises contiguous bytes which store the binary information. In Java, a byte is a primitive datatype that can ...
Read MoreSystem() Function in C/C++
Given the task is to show the working of system() in C/C++. The system() function is a part of the C/C++ standard library. It is used to pass the commands that can be executed in the command processor or the terminal of the operating system, and finally returns the command after it has been completed. or should be included to call this function. Syntax The syntax is as follows − int system(char command) This function returns zero if the command is executed without any errors. Example Input: system("date") Output: The current date is: Fri 12/27/2019 Explanation ...
Read MoreCount odd and even digits in a number in PL/SQL
We are given a positive integer of digits and the task is to calculate the count of odd and even digits in a number using PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL.PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java. Input int number = 23146579 Output count of odd digits in a number are : 5 count of even digits in a number are : 3Explanation − ...
Read MoreWhy does Python sometimes take so long to start on Windows?
Python is a very popular programming language among the Developers and very easy to understand. Its syntax is also very simple to understand, like JAVA and C. But this popular language has some problems and one of the major problems is that it takes so long to start. There can be so many reasons for being slow in Windows Maybe the system configuration is not identical, particular for python. Malware virus slowing the window system. Too many applications running on the window system so python is not getting the proper resources. Slow Execution problem As you know python ...
Read MoreArray Partition I in Python
We are given the array, let's say arr[] of 2n integers. We have to make the pair group of the integer elements like(a1, b1), (a2, b2)....(an, bn) which makes the sum of min(ai, bi) for all elements in the array as large as possible. The task is to find the maximum sum of pairs For example arr[] = [1, 2, 3, 4] and output is 4 the maximum sum of pairs is 4. The all possible are − (1, 2) and (3, 4) -> min(1, 2) + min(3, 4) = 1 + 3 = 4. (1, 4) and (2, 3) ...
Read MorePython Challenges to Develop Your Skills
As you know Python is ranked in topmost used programming language. Python programming language is easy to learn and easy to use. If you know the basics of python you can develop some easy projects like the TIC TAC TOE game and also you can enroll in easy python coding challenges. These coding challenges will help you to improve your coding logics and if you are an intermediate level python programmer you can take a python challenge to enhance your python skills to become a professional or experienced python programmer. Some python programming challenges for beginners. 1. Basic calculator. Basic ...
Read MoreMerge Sort Tree in C++
We are given an integer array, a set of segment start and end pointers and a key value and the problem statement here is to find all the values in the given range which are smaller than or equal to the given key value.Let us understand with exampleInput − arr[] = {7, 8 , 1, 4 , 6 , 8 , 10 }Segment 1: start = 2, end = 4, k = 2Segment 2: start = 1, end = 6, k = 3Output − Count of number which are smaller than or equal to key value in the given range are 2 ...
Read MoreMerge Sort using Multithreading in C++
We are given an unsorted integer array. The task is to sort the array using merge sort technique implemented via Multi-threadingMerge SortMerge sort is a sorting technique which is based on divide and conquer technique where we divide the array into equal halves and then combine them in a sorted manner.Algorithm to implement merge sort ischeck if there is one element in the list then return the element.Else, Divide the data recursively into two halves until it can’t be divided further.Finally, merge the smaller lists into new lists in sorted order.Multi-ThreadingIn the operating system, Threads are the lightweight process which ...
Read More