Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 1887 of 2650
193 Views
In this tutorial, we will be discussing a program to find the number of columns in a matrix which are sorted in descending.For this we will be provided with a matrix. Our task is to count the number of columns in the matrix having elements sorted in descending order.Example Live Demo#include #define MAX 100 using namespace std; //counting columns sorted in descending order int count_dcolumns(int mat[][MAX], int r, int c){ int result = 0; for (int i=0; i0; j--) if (mat[i][j-1] >= mat[i][j]) break; if ... Read More
174 Views
In this tutorial, we will be discussing a program to find the numbers in a range with the smallest factor as K.For this we will be provided with a range [a,b]. Our task is to count the numbers in the given range who have their smallest factor as K.Example Live Demo#include using namespace std; //checking if K is a prime bool if_prime(int k){ if (k
369 Views
In this tutorial, we will be discussing a program to find the number of sub sequences having product less than K.For this we will be provided with non-negative array and a value k. Our task is to find all the subsequences in the array having product less than k.Example Live Demo#include using namespace std; //counting subsequences with product //less than k int count_sub(vector &arr, int k){ int n = arr.size(); int dp[k + 1][n + 1]; memset(dp, 0, sizeof(dp)); for (int i = 1; i
9K+ Views
In this tutorial, we will be discussing how to handle the divide by Zero exception in C++.Division by zero is an undefined entity in mathematics, and we need to handle it properly while programming so that it doesn’t return at error at the user end.Using the runtime_error classExample Live Demo#include #include using namespace std; //handling divide by zero float Division(float num, float den){ if (den == 0) { throw runtime_error("Math error: Attempted to divide by Zero"); } return (num / den); } int main(){ float numerator, denominator, result; numerator = 12.5; denominator = 0; try { result = Division(numerator, denominator); cout
168 Views
In this tutorial, we will be discussing a program to understand how arrays are passed to functions.In the case of C/C++, the arrays are passed to a function in the form of a pointer which provides the address to the very first element of the array.Example Live Demo#include //passing array as a pointer void fun(int arr[]){ unsigned int n = sizeof(arr)/sizeof(arr[0]); printf("Array size inside fun() is %d", n); } int main(){ int arr[] = {1, 2, 3, 4, 5, 6, 7, 8}; unsigned int n = sizeof(arr)/sizeof(arr[0]); printf("Array size inside main() is %d", n); ... Read More
2K+ Views
The CSV file or comma separated values file are one of the most widely used flat files to store and hare data across platforms. The columns are separated by comma and there is optional header row also which will indicate the name of each column. Python can read the CSV files using many modules. In this article we will see how the CSV library in python can be used to read and write a CSV file. We can also see the pandas library onl to read the CSV file.Reading CSV file using csv moduleWe can get the CSV file from ... Read More
2K+ Views
Python language is used extensively for web programming. When we browser website we use the web address which is also known as URL or uniform resource locator. Python has inbuilt materials which can handle the calls to the URL as well as pass the result that comes out of visiting the URL. In this article we will see a module named as urllib. We will also see the various functions present in this module which help in getting the result from the URL.Installing urllibTo install urllib in the python environment, we use the below command using pip.pip install urllibRunning the ... Read More
344 Views
Sentiment Analysis is the process of estimating the sentiment of people who give feedback to certain event either through written text or through oral communication. Of course the oral communication also has to be converted to written text so that it can be analysed through python program. The sentiment expressed by people may be positive or negative. By assigning weightage to the different words in the sentiment text we calculate a numeric value and that gives us a mathematical evaluation of the sentiment.UsefulnessCustomer Fedback − It is vital for business to know the customer’s opinion about product or services. When ... Read More
502 Views
In Python deque is a data structure like stack and queue. It allows append and pop operations from both the ends of the queue. And that makes it different from the rest of the data structures. There are various operations which are listed below that is applicable to deque. In this article we will see the examples on each of those operations. The collections module is used to implement deque.Deque OperationsBelow are some of the useful operations carried out using dequeappend() − This function is used to insert the value in its argument to the right end of deque.appendleft() − ... Read More
4K+ Views
As part of data processing activity we sometimes need to append one string with another. In this article we will see how to append dynamic number of zeros to a given string. This can be done by using various string functions as shown in the programs below.Using ljust and lenPython string method ljust() returns the string left justified in a string of length width. Padding is done using the specified fillchar (default is a space). The len() returns the length of the string. We add trailing zeros to the string by manipulating the length of the given string and the ... Read More