title
stringlengths
3
221
text
stringlengths
17
477k
parsed
listlengths
0
3.17k
Multimap vs Map in C++ STL with Examples
23 Nov, 2021 Map in C++ STL Map stores unique key-value pairs in a sorted manner. Each key is uniquely associated with a value that may or may not be unique. A key can be inserted or deleted from a map but cannot be modified. Values assigned to keys can be changed. It is a great way for quickly accessing value using th...
[ { "code": null, "e": 28, "s": 0, "text": "\n23 Nov, 2021" }, { "code": null, "e": 43, "s": 28, "text": "Map in C++ STL" }, { "code": null, "e": 371, "s": 43, "text": "Map stores unique key-value pairs in a sorted manner. Each key is uniquely associated with a ...
What is the use of `%p` in printf in C?
In C we have seen different format specifiers. Here we will see another format specifier called %p. This is used to print the pointer type data. Let us see the example to get a better idea. #include<stdio.h> main() { int x = 50; int *ptr = &x; printf("The address is: %p, the value is %d", ptr, *ptr); } The add...
[ { "code": null, "e": 1377, "s": 1187, "text": "In C we have seen different format specifiers. Here we will see another format specifier called %p. This is used to print the pointer type data. Let us see the example to get a better idea." }, { "code": null, "e": 1500, "s": 1377, "...
Longest Increasing Path in Matrix
22 Jun, 2022 Given a matrix of N rows and M columns. From m[i][j], we can move to m[i+1][j], if m[i+1][j] > m[i][j], or can move to m[i][j+1] if m[i][j+1] > m[i][j]. The task is print longest path length if we start from (0, 0).Examples: Input : N = 4, M = 4 m[][] = { { 1, 2, 3, 4 }, { 2, 2,...
[ { "code": null, "e": 54, "s": 26, "text": "\n22 Jun, 2022" }, { "code": null, "e": 281, "s": 54, "text": "Given a matrix of N rows and M columns. From m[i][j], we can move to m[i+1][j], if m[i+1][j] > m[i][j], or can move to m[i][j+1] if m[i][j+1] > m[i][j]. The task is print lon...
How to check if a file is readable, writable, or, executable in Java?
In general, whenever you create a file you can restrict/permit certain users from reading/writing/executing a file. In Java files (their abstract paths) are represented by the File class of the java.io package. This class provides various methods to perform various operations on files such as read, write, delete, renam...
[ { "code": null, "e": 1303, "s": 1187, "text": "In general, whenever you create a file you can restrict/permit certain users from reading/writing/executing a file." }, { "code": null, "e": 1515, "s": 1303, "text": "In Java files (their abstract paths) are represented by the File c...
Python | Print number of leap years from given list of years
24 Sep, 2021 The problem of finding leap year is quite generic and we might face the issue of finding the number of leap years in given list of years. Let’s discuss certain ways in which this can be performed. Method #1: Using Iteration Check whether year is a multiple of 4 and not multiple of 100 or year is multiple o...
[ { "code": null, "e": 28, "s": 0, "text": "\n24 Sep, 2021" }, { "code": null, "e": 225, "s": 28, "text": "The problem of finding leap year is quite generic and we might face the issue of finding the number of leap years in given list of years. Let’s discuss certain ways in which t...
KNN Model Complexity
05 Sep, 2020 KNN is a machine learning algorithm which is used for both classification (using KNearestClassifier) and Regression (using KNearestRegressor) problems.In KNN algorithm K is the Hyperparameter. Choosing the right value of K matters. A machine learning model is said to have high model complexity if the built...
[ { "code": null, "e": 54, "s": 26, "text": "\n05 Sep, 2020" }, { "code": null, "e": 406, "s": 54, "text": "KNN is a machine learning algorithm which is used for both classification (using KNearestClassifier) and Regression (using KNearestRegressor) problems.In KNN algorithm K is t...
GATE | GATE CS 2013 | Question 65
09 Oct, 2019 Consider the following relational schema. Students(rollno: integer, sname: string) Courses(courseno: integer, cname: string) Registration(rollno: integer, courseno: integer, percent: real) Which of the following queries are equivalent to this query in English? "Find the distinct names of ...
[ { "code": null, "e": 54, "s": 26, "text": "\n09 Oct, 2019" }, { "code": null, "e": 96, "s": 54, "text": "Consider the following relational schema." }, { "code": null, "e": 255, "s": 96, "text": " Students(rollno: integer, sname: string)\n Courses(coursen...
How to get or set the resolution of an image using imageresolution() function in PHP?
imageresoulution() is an inbuilt function in PHP that is used to get or set the resolution of an image in dots per inch. If no optional parameters are given, then the current resolution is returned as an indexed array. If one of the optional parameters is given, then it will set both the width and height to that parame...
[ { "code": null, "e": 1512, "s": 1187, "text": "imageresoulution() is an inbuilt function in PHP that is used to get or set the resolution of an image in dots per inch. If no optional parameters are given, then the current resolution is returned as an indexed array. If one of the optional parameters ...
Python | Pandas DataFrame.dtypes
20 Feb, 2019 Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. It can be thought of as a dict-like container for Series objects. This is the primary data structure of the P...
[ { "code": null, "e": 53, "s": 25, "text": "\n20 Feb, 2019" }, { "code": null, "e": 367, "s": 53, "text": "Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both...
Using htop to Monitor System Processes on Linux
30 Jun, 2021 htop a Linux tool that is used in process-managing and terminal-based system monitoring. It allows real-time monitoring of processes and performs every task to monitor the process in the Linux system. The tool is written in the C programming language by Hisham Muhammad. It displays a complete list of proce...
[ { "code": null, "e": 28, "s": 0, "text": "\n30 Jun, 2021" }, { "code": null, "e": 600, "s": 28, "text": "htop a Linux tool that is used in process-managing and terminal-based system monitoring. It allows real-time monitoring of processes and performs every task to monitor the pro...
Python | Separate odd and even index elements
20 May, 2021 Python list are quite popular and no matter what type of field one is coding, one has to deal with lists and its various applications. In this particular article, we discuss ways to separate odd and even indexed elements and its reconstruction join. Let’s discuss ways to achieve this. Method #1 : Using Na...
[ { "code": null, "e": 54, "s": 26, "text": "\n20 May, 2021" }, { "code": null, "e": 341, "s": 54, "text": "Python list are quite popular and no matter what type of field one is coding, one has to deal with lists and its various applications. In this particular article, we discuss ...
Build a Simple static file web server in Node.js
14 Oct, 2021 In this article, we will build a static file web server which will list out all the files in the directory and on clicking the file name it displays the file content. Steps for creating a static file server is as follows: Step 1: Importing necessary modules, and defining MIME types which helps browser to u...
[ { "code": null, "e": 28, "s": 0, "text": "\n14 Oct, 2021" }, { "code": null, "e": 250, "s": 28, "text": "In this article, we will build a static file web server which will list out all the files in the directory and on clicking the file name it displays the file content. Steps fo...
How to use flex to shrink an image in CSS ?
30 Jul, 2021 You can easily shrink an image by using the flex-wrap property in CSS and it specifies whether flex items are forced into a single line or wrapped onto multiple lines. The flex-wrap property allows enabling the control direction in which lines are stacked. It is used to designate a single line or multi-lin...
[ { "code": null, "e": 28, "s": 0, "text": "\n30 Jul, 2021" }, { "code": null, "e": 386, "s": 28, "text": "You can easily shrink an image by using the flex-wrap property in CSS and it specifies whether flex items are forced into a single line or wrapped onto multiple lines. The fle...
Working with BigDecimal values in Java
The java.math.BigDecimal class provides operations for arithmetic, scale manipulation, rounding, comparison, hashing, and format conversion. Two types of operations are provided for manipulating the scale of a BigDecimal − scaling/rounding operations decimal point motion operations The following are some of the constru...
[ { "code": null, "e": 1203, "s": 1062, "text": "The java.math.BigDecimal class provides operations for arithmetic, scale manipulation, rounding, comparison, hashing, and format conversion." }, { "code": null, "e": 1285, "s": 1203, "text": "Two types of operations are provided for ...
Spring Declarative Transaction Management
Declarative transaction management approach allows you to manage the transaction with the help of configuration instead of hard coding in your source code. This means that you can separate transaction management from the business code. You only use annotations or XML-based configuration to manage the transactions. The ...
[ { "code": null, "e": 2738, "s": 2292, "text": "Declarative transaction management approach allows you to manage the transaction with the help of configuration instead of hard coding in your source code. This means that you can separate transaction management from the business code. You only use anno...
Biopython - Sequence
A sequence is series of letters used to represent an organism’s protein, DNA or RNA. It is represented by Seq class. Seq class is defined in Bio.Seq module. Let’s create a simple sequence in Biopython as shown below − >>> from Bio.Seq import Seq >>> seq = Seq("AGCT") >>> seq Seq('AGCT') >>> print(seq) AGCT Here, w...
[ { "code": null, "e": 2263, "s": 2106, "text": "A sequence is series of letters used to represent an organism’s protein, DNA or RNA. It is represented by Seq class. Seq class is defined in Bio.Seq module." }, { "code": null, "e": 2324, "s": 2263, "text": "Let’s create a simple seq...
Analyzing my weight loss with machine learning | by Khanh Nguyen | Towards Data Science
To see the code I wrote for this project, you can check out its Github repo I began my weight loss journey at the start of 2018, following the oft-cited advice of “weight loss = diet + exercise”. On the diet side, I started tracking my daily food consumption (using a food scale and recording calories via the Loseit app...
[ { "code": null, "e": 248, "s": 172, "text": "To see the code I wrote for this project, you can check out its Github repo" }, { "code": null, "e": 760, "s": 248, "text": "I began my weight loss journey at the start of 2018, following the oft-cited advice of “weight loss = diet + e...
How to use BooleanSupplier in lambda expression in Java?
BooleanSupplier is a functional interface defined in the "java.util.function" package. This interface can be used as an assignment target for a lambda expression or method reference. BooleanSupplier interface has only one method getAsBoolean() and returns a boolean result, true or false. @FunctionalInterface public int...
[ { "code": null, "e": 1351, "s": 1062, "text": "BooleanSupplier is a functional interface defined in the \"java.util.function\" package. This interface can be used as an assignment target for a lambda expression or method reference. BooleanSupplier interface has only one method getAsBoolean() and ret...
NumPy Searching Arrays
You can search an array for a certain value, and return the indexes that get a match. To search an array, use the where() method. Find the indexes where the value is 4: The example above will return a tuple: (array([3, 5, 6],) Which means that the value 4 is present at index 3, 5, and 6. Find the indexes where the valu...
[ { "code": null, "e": 86, "s": 0, "text": "You can search an array for a certain value, and return the indexes that get a match." }, { "code": null, "e": 130, "s": 86, "text": "To search an array, use the where() method." }, { "code": null, "e": 169, "s": 130, ...
Program to Interchange Diagonals of Matrix
24 May, 2022 Given a square matrix of order n*n, you have to interchange the elements of both diagonals. Examples : Input : matrix[][] = {1, 2, 3, 4, 5, 6, 7, 8, 9} Output : matrix[][] = {3, 2, 1, 4, 5, 6, 9, 8, 7} Input : ma...
[ { "code": null, "e": 54, "s": 26, "text": "\n24 May, 2022" }, { "code": null, "e": 159, "s": 54, "text": "Given a square matrix of order n*n, you have to interchange the elements of both diagonals. Examples : " }, { "code": null, "e": 652, "s": 159, "text": "...
Dynamic Arrays and its Operations in Solidity
17 Nov, 2020 The Dynamic arrays are the arrays that are allocated memory at the runtime and the memory is allocated from the heap. Syntax: // declaration of dynamic array int[] private arr; How They Are Different From Fixed Size Arrays? The fixed-size array has a fixed memory size whereas, in dynamic arrays, the s...
[ { "code": null, "e": 28, "s": 0, "text": "\n17 Nov, 2020" }, { "code": null, "e": 147, "s": 28, "text": "The Dynamic arrays are the arrays that are allocated memory at the runtime and the memory is allocated from the heap. " }, { "code": null, "e": 155, "s": 147, ...
Python - Check if dictionary is empty
During analysis of data sets we may come across situations where we have to deal with empty dictionaries. In tis article we will see how to check if a dictionary is empty or not. The if condition evaluates to true if the dictionary has elements. Otherwise it evaluates to false. So in the below program we will just chec...
[ { "code": null, "e": 1366, "s": 1187, "text": "During analysis of data sets we may come across situations where we have to deal with empty dictionaries. In tis article we will see how to check if a dictionary is empty or not." }, { "code": null, "e": 1568, "s": 1366, "text": "The...
Type Conversion in C++
Here we will see what are the type conversion techniques present in C++. There are mainly two types of type conversion. The implicit and explicit. Implicit type conversionThis is also known as automatic type conversion. This is done by the compiler without any external trigger from the user. This is done when one expre...
[ { "code": null, "e": 1334, "s": 1187, "text": "Here we will see what are the type conversion techniques present in C++. There are mainly two types of type conversion. The implicit and explicit." }, { "code": null, "e": 1617, "s": 1334, "text": "Implicit type conversionThis is als...
Matplotlib.axis.Axis.set_major_locator() function in Python
10 Jun, 2020 Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. The Axis.set_major_locator() function in axis module of matplotlib library is used to ...
[ { "code": null, "e": 28, "s": 0, "text": "\n10 Jun, 2020" }, { "code": null, "e": 249, "s": 28, "text": "Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and u...
How to pass an array as a function parameter in JavaScript ?
26 Nov, 2019 Method 1: Using the apply() method: The apply() method is used to call a function with the given arguments as an array or array-like object. It contains two parameters. The this value provides a call to the function and the arguments array contains the array of arguments to be passed. The apply() method is...
[ { "code": null, "e": 53, "s": 25, "text": "\n26 Nov, 2019" }, { "code": null, "e": 339, "s": 53, "text": "Method 1: Using the apply() method: The apply() method is used to call a function with the given arguments as an array or array-like object. It contains two parameters. The t...
How to change the font size in HTML?
15 Mar, 2021 In this article, we will learn how one can change the font size in HTML. This can be used in situations where a text has to be highlighted due to its importance or made smaller for a caption. This can be achieved using the following approaches. Approach 1: The <font> tag in HTML can be used for making chan...
[ { "code": null, "e": 28, "s": 0, "text": "\n15 Mar, 2021" }, { "code": null, "e": 273, "s": 28, "text": "In this article, we will learn how one can change the font size in HTML. This can be used in situations where a text has to be highlighted due to its importance or made smalle...
Paytm Interview Experience 2020
11 Nov, 2020 I hope Everyone must have heard about Paytm. To get more information visit https://paytm.com/ Online Coding Round(70 minutes): There were 3 coding problems Based on a simple Number system given an integer, just ou have to change the digit9-->0 8-->1 7-->2 6-->3 5-->4 ......... so on 0 -->9Example: Conver...
[ { "code": null, "e": 28, "s": 0, "text": "\n11 Nov, 2020" }, { "code": null, "e": 122, "s": 28, "text": "I hope Everyone must have heard about Paytm. To get more information visit https://paytm.com/" }, { "code": null, "e": 185, "s": 122, "text": "Online Codin...
Regular Expressions in Python – Set 2 (Search, Match and Find All)
14 Dec, 2021 Regular Expression in Python with Examples | Set 1The module re provides support for regular expressions in Python. Below are main methods in this module. Searching an occurrence of pattern re.search() : This method either returns None (if the pattern doesn’t match), or a re.MatchObject that contains info...
[ { "code": null, "e": 54, "s": 26, "text": "\n14 Dec, 2021" }, { "code": null, "e": 209, "s": 54, "text": "Regular Expression in Python with Examples | Set 1The module re provides support for regular expressions in Python. Below are main methods in this module." }, { "code...
std::replace and std::replace_if in C++
26 Apr, 2022 std::replace Assigns new_value to all the elements in the range [first, last) that compare to old_value. The function use operator == to compare the individual elements to old_value Function Template : void replace (ForwardIterator first, ForwardIterator last, const T& old_va...
[ { "code": null, "e": 52, "s": 24, "text": "\n26 Apr, 2022" }, { "code": null, "e": 65, "s": 52, "text": "std::replace" }, { "code": null, "e": 235, "s": 65, "text": "Assigns new_value to all the elements in the range [first, last) that compare to old_value. Th...
LINQ | Generation Operator | DefaultIfEmpty
26 May, 2019 The generation operators are used for creating a new sequence of values. The Standard Query Operator supports 4 different types of generation operators: DefaultIfEmptyEmptyRangeRepeat DefaultIfEmpty Empty Range Repeat The DefaultIfEmpty operator is used to replace an empty collection or sequence with a def...
[ { "code": null, "e": 28, "s": 0, "text": "\n26 May, 2019" }, { "code": null, "e": 181, "s": 28, "text": "The generation operators are used for creating a new sequence of values. The Standard Query Operator supports 4 different types of generation operators:" }, { "code": ...
Java Program to Count Primes in Ranges
13 Jan, 2022 Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 <= L <= R < 10000. Consider that there are a large number of queries for different ranges.Examples: Input : Query 1 : L = 1, R = 10 Query 2 : L = 5, R = 10 Output : 4 2 Explanati...
[ { "code": null, "e": 28, "s": 0, "text": "\n13 Jan, 2022" }, { "code": null, "e": 240, "s": 28, "text": "Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 <= L <= R < 10000. Consider that there are a large number of quer...
How to Create User in Oracle Database ?
28 Oct, 2021 In oracle there are different type of user accounts system, sys, hr and many more. This user accounts is by default created by oracle .If you want to create your own user then you can create it by two different methods. Step 1. Login to your database as normally you would by username and password. Step 2. ...
[ { "code": null, "e": 28, "s": 0, "text": "\n28 Oct, 2021" }, { "code": null, "e": 248, "s": 28, "text": "In oracle there are different type of user accounts system, sys, hr and many more. This user accounts is by default created by oracle .If you want to create your own user then...
How to convert array of strings to array of numbers in JavaScript ?
22 Jun, 2021 In this article, we have given an array of strings and the task is to convert it into an array of numbers in JavaScript. Input: ["1","2","3","4","5"] Output: [1,2,3,4,5] Input: ["10","21","3","14","53"] Output: [10,21,3,14,53] There are two methods to do this, which are given below: Method 1: Array traver...
[ { "code": null, "e": 54, "s": 26, "text": "\n22 Jun, 2021" }, { "code": null, "e": 175, "s": 54, "text": "In this article, we have given an array of strings and the task is to convert it into an array of numbers in JavaScript." }, { "code": null, "e": 282, "s": 17...
Stack iterator() method in Java with Example
24 Dec, 2018 The Java.util.Stack.iterator() method is used to return an iterator of the same elements as that of the Stack. The elements are returned in random order from what was present in the stack. Syntax: Iterator iterate_value = Stack.iterator(); Parameters: The function does not take any parameter. Return Value...
[ { "code": null, "e": 53, "s": 25, "text": "\n24 Dec, 2018" }, { "code": null, "e": 242, "s": 53, "text": "The Java.util.Stack.iterator() method is used to return an iterator of the same elements as that of the Stack. The elements are returned in random order from what was present...
Explain serial execution or transaction with an example(DBMS)
There are three possible ways in which a transaction can be executed. These are as follows − Serial execution − In serial execution, the second transaction can begin its execution only after the first transaction has completed. This is possible on a uniprocessor system. Serial execution − In serial execution, the secon...
[ { "code": null, "e": 1155, "s": 1062, "text": "There are three possible ways in which a transaction can be executed. These are as follows −" }, { "code": null, "e": 1333, "s": 1155, "text": "Serial execution − In serial execution, the second transaction can begin its execution on...
Find multiplication of sums of data of leaves at same levels - GeeksforGeeks
11 Jun, 2021 Given a Binary Tree, return following value for it. 1) For every level, compute sum of all leaves if there are leaves at this level. Otherwise, ignore it. 2) Return multiplication of all sums.Examples: Input: Root of below tree 2 / \ 7 5 \ 9 Output: ...
[ { "code": null, "e": 24830, "s": 24802, "text": "\n11 Jun, 2021" }, { "code": null, "e": 25034, "s": 24830, "text": "Given a Binary Tree, return following value for it. 1) For every level, compute sum of all leaves if there are leaves at this level. Otherwise, ignore it. 2) Retur...
How to Build a Web Scraper in Python | by Roman Paolucci | Towards Data Science
Web scraping is an awesome tool for analysts to sift through and collect large amounts of public data. Using keywords relevant to the topic in question, a good web scraper can gather large amounts of data very quickly and aggregate it into a dataset. There are several libraries in Python that make this extremely easy t...
[ { "code": null, "e": 694, "s": 172, "text": "Web scraping is an awesome tool for analysts to sift through and collect large amounts of public data. Using keywords relevant to the topic in question, a good web scraper can gather large amounts of data very quickly and aggregate it into a dataset. Ther...
Getting Started with Plotly-Python - GeeksforGeeks
15 Jul, 2021 The Plotly Python library is an interactive open-source library. This can be a very helpful tool for data visualization and understanding the data simply and easily. plotly graph objects are a high-level interface to plotly which are easy to use. It can plot various types of graphs and charts like scatter ...
[ { "code": null, "e": 24316, "s": 24288, "text": "\n15 Jul, 2021" }, { "code": null, "e": 24696, "s": 24316, "text": "The Plotly Python library is an interactive open-source library. This can be a very helpful tool for data visualization and understanding the data simply and easil...
Sentiment classification in Python | by Zolzaya Luvsandorj | Towards Data Science
This post is the last of the three sequential posts on steps to build a sentiment classifier. Having done some exploratory text analysis and preprocessed the text, it’s time to classify reviews to sentiments. In this post, we will first look at 2 ways to get sentiments without building a model then build a custom model...
[ { "code": null, "e": 494, "s": 172, "text": "This post is the last of the three sequential posts on steps to build a sentiment classifier. Having done some exploratory text analysis and preprocessed the text, it’s time to classify reviews to sentiments. In this post, we will first look at 2 ways to ...
Spring AOP - Annotation Based PointCut
A JoinPoint represents a point in your application where you can plug-in AOP aspect. You can also say, it is the actual place in the application where an action will be taken using Spring AOP framework. Consider the following examples − All methods classes contained in a package(s). All methods classes contained in a p...
[ { "code": null, "e": 2506, "s": 2269, "text": "A JoinPoint represents a point in your application where you can plug-in AOP aspect. You can also say, it is the actual place in the application where an action will be taken using Spring AOP framework. Consider the following examples −" }, { "c...
Decode String in C++
Suppose we have an encoded string; we have to return its decoded string. The rule for encoding is: k[encoded_string], this indicates where the encoded_string inside the square brackets is being repeated exactly k times. We can assume that the original data does not contain any numeric characters and that digits are onl...
[ { "code": null, "e": 1485, "s": 1062, "text": "Suppose we have an encoded string; we have to return its decoded string. The rule for encoding is: k[encoded_string], this indicates where the encoded_string inside the square brackets is being repeated exactly k times. We can assume that the original d...
How To Downfill Null Values In SQL | Towards Data Science
When it comes to data analysis, you often don’t realize what you’re missing until you visualize it. Huge gaps or downward spikes in visualizations will show you exactly where the data is missing, but that’s not a story you want to communicate to your stakeholders. While some visualization tools can cover these gaps wit...
[ { "code": null, "e": 437, "s": 172, "text": "When it comes to data analysis, you often don’t realize what you’re missing until you visualize it. Huge gaps or downward spikes in visualizations will show you exactly where the data is missing, but that’s not a story you want to communicate to your stak...
Arduino - Fading LED
This example demonstrates the use of the analogWrite() function in fading an LED off. AnalogWrite uses pulse width modulation (PWM), turning a digital pin on and off very quickly with different ratios between on and off, to create a fading effect. You will need the following components − 1 × Breadboard 1 × Arduino Uno ...
[ { "code": null, "e": 3118, "s": 2870, "text": "This example demonstrates the use of the analogWrite() function in fading an LED off. AnalogWrite uses pulse width modulation (PWM), turning a digital pin on and off very quickly with different ratios between on and off, to create a fading effect." },...
Simple and Multiple Linear Regression in Python | by Adi Bronshtein | Towards Data Science
Quick introduction to linear regression in Python Hi everyone! After briefly introducing the “Pandas” library as well as the NumPy library, I wanted to provide a quick introduction to building models in Python, and what better place to start than one of the very basic models, linear regression? This will be the first p...
[ { "code": null, "e": 221, "s": 171, "text": "Quick introduction to linear regression in Python" }, { "code": null, "e": 644, "s": 221, "text": "Hi everyone! After briefly introducing the “Pandas” library as well as the NumPy library, I wanted to provide a quick introduction to bu...
LISP - Bitwise Operators
Bitwise operators work on bits and perform bit-by-bit operation. The truth tables for bitwise and, or, and xor operations are as follows − Assume if A = 60; and B = 13; now in binary format they will be as follows: A = 0011 1100 B = 0000 1101 ----------------- A and B = 0000 1100 A or B = 0011 1101 A xor B = 0011 0001 ...
[ { "code": null, "e": 2199, "s": 2060, "text": "Bitwise operators work on bits and perform bit-by-bit operation. The truth tables for bitwise and, or, and xor operations are as follows −" }, { "code": null, "e": 2399, "s": 2199, "text": "Assume if A = 60; and B = 13; now in binary...
Exception and Exception Classes
In general, an exception is any unusual condition. Exception usually indicates errors but sometimes they intentionally puts in the program, in cases like terminating a procedure early or recovering from a resource shortage. There are number of built-in exceptions, which indicate conditions like reading past the end of ...
[ { "code": null, "e": 2217, "s": 1810, "text": "In general, an exception is any unusual condition. Exception usually indicates errors but sometimes they intentionally puts in the program, in cases like terminating a procedure early or recovering from a resource shortage. There are number of built-in ...
How to Analyze Emotions and Words of the Lyrics From your Favorite Music Artist | by Cristóbal Veas | Towards Data Science
Music is a powerful language to express our feelings and in many cases is used as a therapy to deal with tough moments in our lives. The different sounds, rhythms, and effects used in music are capable to modify our emotions for a moment, but there’s a component that sometimes goes unnoticed when we are listening to mu...
[ { "code": null, "e": 522, "s": 172, "text": "Music is a powerful language to express our feelings and in many cases is used as a therapy to deal with tough moments in our lives. The different sounds, rhythms, and effects used in music are capable to modify our emotions for a moment, but there’s a co...
Group with multiple fields and get the count of duplicate field values grouped together in MongoDB
For this, use MongoDB aggregate and within that, use $cond. The $cond evaluates a boolean expression to return one of the two specified return expressions. Let us first create a collection with documents − > db.demo536.insertOne({"Name1":"Chris","Name2":"David"});{ "acknowledged" : true, "insertedId" : ObjectId("...
[ { "code": null, "e": 1218, "s": 1062, "text": "For this, use MongoDB aggregate and within that, use $cond. The $cond evaluates a boolean expression to return one of the two specified return expressions." }, { "code": null, "e": 1268, "s": 1218, "text": "Let us first create a coll...
Elixir - Case Statement
Case statement can be considered as a replacement for the switch statement in imperative languages. Case takes a variable/literal and applies pattern matching to it with different cases. If any case matches, Elixir executes the code associated with that case and exits the case statement. If no match is found, it exits ...
[ { "code": null, "e": 2775, "s": 2182, "text": "Case statement can be considered as a replacement for the switch statement in imperative languages. Case takes a variable/literal and applies pattern matching to it with different cases. If any case matches, Elixir executes the code associated with that...
How to change Tkinter label text on button press?
Most often, Tkinter Label widgets are used in the application to display the text or images. We can configure the label widget such as its text property, color, background or foreground color using the config(**options) method. If you need to modify or change the label widget dynamically, then you can use a button and ...
[ { "code": null, "e": 1290, "s": 1062, "text": "Most often, Tkinter Label widgets are used in the application to display the text or images. We can configure the label widget such as its text property, color, background or foreground color using the config(**options) method." }, { "code": nul...
How to compare two slices of bytes in Golang? - GeeksforGeeks
26 Aug, 2019 In Go language slice is more powerful, flexible, convenient than an array, and is a lightweight data structure. The slice is a variable-length sequence which stores elements of a similar type, you are not allowed to store different type of elements in the same slice. In the Go slice, you are allowed to com...
[ { "code": null, "e": 24436, "s": 24408, "text": "\n26 Aug, 2019" }, { "code": null, "e": 24929, "s": 24436, "text": "In Go language slice is more powerful, flexible, convenient than an array, and is a lightweight data structure. The slice is a variable-length sequence which store...
How to show a bar and line graph on the same plot in Matplotlib?
To show a bar and line graph on the same plot in matplotlib, we can take the following steps − Set the figure size and adjust the padding between and around the subplots. Set the figure size and adjust the padding between and around the subplots. Make a two-dimensional, size-mutable, potentially heterogeneous tabular d...
[ { "code": null, "e": 1157, "s": 1062, "text": "To show a bar and line graph on the same plot in matplotlib, we can take the following steps −" }, { "code": null, "e": 1233, "s": 1157, "text": "Set the figure size and adjust the padding between and around the subplots." }, { ...
Exploratory Data Analysis(EDA) with PySpark on Databricks | by Cao YI | Towards Data Science
bye-bye, Pandas... EDA with spark means saying bye-bye to Pandas. Due to the large scale of data, every calculation must be parallelized, instead of Pandas, pyspark.sql.functions are the right tools you can use. It is, for sure, struggling to change your old data-wrangling habit. I hope this post can give you a jump st...
[ { "code": null, "e": 66, "s": 47, "text": "bye-bye, Pandas..." }, { "code": null, "e": 398, "s": 66, "text": "EDA with spark means saying bye-bye to Pandas. Due to the large scale of data, every calculation must be parallelized, instead of Pandas, pyspark.sql.functions are the ri...
Python - Text Translation
Text translation from one language to another is increasingly becoming common for various websites as they cater to an international audience. The python package which helps us do this is called translate. This package can be installed by the following way. It provides translation for major languages. pip install trans...
[ { "code": null, "e": 2793, "s": 2587, "text": "Text translation from one language to another is increasingly becoming common for various websites as they cater to an international audience. The python package which helps us do this is called translate." }, { "code": null, "e": 2890, ...
getpagesize() - Unix, Linux System Call
Unix - Home Unix - Getting Started Unix - File Management Unix - Directories Unix - File Permission Unix - Environment Unix - Basic Utilities Unix - Pipes & Filters Unix - Processes Unix - Communication Unix - The vi Editor Unix - What is Shell? Unix - Using Variables Unix - Special Variables Unix - Using Arrays Unix -...
[ { "code": null, "e": 1466, "s": 1454, "text": "Unix - Home" }, { "code": null, "e": 1489, "s": 1466, "text": "Unix - Getting Started" }, { "code": null, "e": 1512, "s": 1489, "text": "Unix - File Management" }, { "code": null, "e": 1531, "s": 1...
Broadcast Receiver in Android With Example - GeeksforGeeks
18 Jan, 2022 Broadcast in android is the system-wide events that can occur when the device starts, when a message is received on the device or when incoming calls are received, or when a device goes to airplane mode, etc. Broadcast Receivers are used to respond to these system-wide events. Broadcast Receivers allow us ...
[ { "code": null, "e": 24585, "s": 24557, "text": "\n18 Jan, 2022" }, { "code": null, "e": 25065, "s": 24585, "text": "Broadcast in android is the system-wide events that can occur when the device starts, when a message is received on the device or when incoming calls are received,...
Explain PowerShell Profile.
When you open PowerShell, it loads the profile just like the Windows operating system. When you log in to windows OS you are logged into your profile and every user has their individual profile. It is called the current profile for the current host. To check your profile, type $Profile command in the PowerShell console...
[ { "code": null, "e": 1312, "s": 1062, "text": "When you open PowerShell, it loads the profile just like the Windows operating system. When you log in to windows OS you are logged into your profile and every user has their individual profile. It is called the current profile for the current host." ...
false command in Linux with examples - GeeksforGeeks
05 Mar, 2019 false command is used to return an exit status code (“1” by default) that indicates failure. It is useful when the user wants a conditional expression or an argument to always be unsuccessful. When no argument is passed to the false command, it fails with no output and exit status as 1. Syntax: false [argu...
[ { "code": null, "e": 24406, "s": 24378, "text": "\n05 Mar, 2019" }, { "code": null, "e": 24694, "s": 24406, "text": "false command is used to return an exit status code (“1” by default) that indicates failure. It is useful when the user wants a conditional expression or an argume...
An Introduction to Dimensionality Reduction | by Peter Grant | Towards Data Science
High dimensional data sets provide one of the largest challenges in all of data science. The challenge is quite straightforward. Machine learning algorithms require the data set to be dense in order to make accurate predictions. Data spaces get extremely vast as more and more dimensions are added. Vast data spaces requ...
[ { "code": null, "e": 859, "s": 172, "text": "High dimensional data sets provide one of the largest challenges in all of data science. The challenge is quite straightforward. Machine learning algorithms require the data set to be dense in order to make accurate predictions. Data spaces get extremely ...
SAP HANA - SQL Expressions
An Expression is used to evaluate a clause to return values. There are different SQL expressions that can be used in HANA − Case Expressions Function Expressions Aggregate Expressions Subqueries in Expressions This is used to pass multiple conditions in a SQL expression. It allows the use of IF-ELSE-THEN logic without ...
[ { "code": null, "e": 3231, "s": 3107, "text": "An Expression is used to evaluate a clause to return values. There are different SQL expressions that can be used in HANA −" }, { "code": null, "e": 3248, "s": 3231, "text": "Case Expressions" }, { "code": null, "e": 3269...
Python Arrays - GeeksforGeeks
19 Jan, 2022 An array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together. This makes it easier to calculate the position of each element by simply adding an offset to a base value, i.e., the memory location of the first element of the array (gen...
[ { "code": null, "e": 41552, "s": 41524, "text": "\n19 Jan, 2022" }, { "code": null, "e": 42481, "s": 41552, "text": "An array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together. This makes it easier to cal...
How to use OR condition in a JavaScript IF statement?
To use OR condition in JavaScript IF statement, use the || operator i.e Logical OR operator. If any of the two operands are non-zero, then the condition becomes true. Here’s how you can use the operator || in JavaScript Live Demo <html> <body> <script> var a = true; var b = false; d...
[ { "code": null, "e": 1229, "s": 1062, "text": "To use OR condition in JavaScript IF statement, use the || operator i.e Logical OR operator. If any of the two operands are non-zero, then the condition becomes true." }, { "code": null, "e": 1282, "s": 1229, "text": "Here’s how you ...
How to change the column names and row names of a data frame in R?
We can colnames function to change the column names and rownames function to change the row names. > df <- data.frame(ID=1:5,Salry=c(10000,30000,22000,27000,18000)) > df ID Salry 1 1 10000 2 2 30000 3 3 22000 4 4 27000 5 5 18000 > colnames(df)<-c("EmployeeID","Salary") > df EmployeeID Salary 1 1 10000 2 2 30000 3 3 220...
[ { "code": null, "e": 1161, "s": 1062, "text": "We can colnames function to change the column names and rownames function to\nchange the row names." }, { "code": null, "e": 1535, "s": 1161, "text": "> df <- data.frame(ID=1:5,Salry=c(10000,30000,22000,27000,18000))\n> df\nID Salry\...
Cosine Similarity - GeeksforGeeks
06 Oct, 2020 Prerequisite – Measures of Distance in Data Mining In Data Mining, similarity measure refers to distance with dimensions representing features of the data object, in a dataset. If this distance is less, there will be a high degree of similarity, but when the distance is large, there will be a low degree of...
[ { "code": null, "e": 24413, "s": 24385, "text": "\n06 Oct, 2020" }, { "code": null, "e": 24464, "s": 24413, "text": "Prerequisite – Measures of Distance in Data Mining" }, { "code": null, "e": 24733, "s": 24464, "text": "In Data Mining, similarity measure refe...
JavaScript - The Function() Constructor
The function statement is not the only way to define a new function; you can define your function dynamically using Function() constructor along with the new operator. Note − Constructor is a terminology from Object Oriented Programming. You may not feel comfortable for the first time, which is OK. Following is the syn...
[ { "code": null, "e": 2634, "s": 2466, "text": "The function statement is not the only way to define a new function; you can define your function dynamically using Function() constructor along with the new operator." }, { "code": null, "e": 2766, "s": 2634, "text": "Note − Constru...
Introduction to Bootstrapping in Data Science — part 1 | by Alejandro Rodríguez | Towards Data Science
You know the drill: there is a population and you would like to estimate a characteristic, for example, the mean. Unfortunately, you cannot measure every individual in the population, so you draw a sample. Following the guidelines in your favourite statistics book, you simplify the problem by assuming that the paramete...
[ { "code": null, "e": 717, "s": 47, "text": "You know the drill: there is a population and you would like to estimate a characteristic, for example, the mean. Unfortunately, you cannot measure every individual in the population, so you draw a sample. Following the guidelines in your favourite statist...
DAX Other - SUMMARIZECOLUMNS function
Returns a summary table over a set of groups. DAX SUMMARIZECOLUMNS function is new in Excel 2016. SUMMARIZECOLUMNS (<groupBy_columnName>, [< groupBy_columnName >] ..., [<filterTable>] ..., [<name>, <expression>] ...) groupBy_columnName A fully qualified column reference (Table[Column]) to a base table for which t...
[ { "code": null, "e": 2047, "s": 2001, "text": "Returns a summary table over a set of groups." }, { "code": null, "e": 2099, "s": 2047, "text": "DAX SUMMARIZECOLUMNS function is new in Excel 2016." }, { "code": null, "e": 2224, "s": 2099, "text": "SUMMARIZECOLU...
Understanding Generator Expressions In Python | by Richmond Alake | Towards Data Science
This article is an introduction to generator expressions(Genexps) within the Python programming language. This article is aimed at developers of all levels. If you’re a beginner, you can pick up new concepts such as generator expressions, list comprehensions(listcomps) and sequence type generations. Intermediate develo...
[ { "code": null, "e": 278, "s": 172, "text": "This article is an introduction to generator expressions(Genexps) within the Python programming language." }, { "code": null, "e": 603, "s": 278, "text": "This article is aimed at developers of all levels. If you’re a beginner, you can...
Object Oriented Python - Object Serialization
In the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer) or transmitted and reconstructed later. In serialization, an object is transformed into a format that can be stored, so as to be able to ...
[ { "code": null, "e": 2033, "s": 1810, "text": "In the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer) or transmitted and reconstructed later." }, { "code": null, ...
Groovy - ceil()
The method ceil gives the smallest integer that is greater than or equal to the argument. double ceil(double d) double ceil(float f) Parameters − A double or float primitive data type. Return Value − This method Returns the smallest integer that is greater than or equal to the argument. Returned as a double. Followin...
[ { "code": null, "e": 2328, "s": 2238, "text": "The method ceil gives the smallest integer that is greater than or equal to the argument." }, { "code": null, "e": 2373, "s": 2328, "text": "double ceil(double d) \ndouble ceil(float f)\n" }, { "code": null, "e": 2425, ...
HTML Data Cleaning in Python for NLP | by Brandon Ko | Towards Data Science
The most important step of any data-driven project is obtaining quality data. Without these preprocessing steps, the results of a project can easily be biased or completely misunderstood. Here, we will focus on cleaning data that is composed of scraped web pages. There are many tools to scrape the web. If you are looki...
[ { "code": null, "e": 435, "s": 171, "text": "The most important step of any data-driven project is obtaining quality data. Without these preprocessing steps, the results of a project can easily be biased or completely misunderstood. Here, we will focus on cleaning data that is composed of scraped we...
Bitwise Operators in C
The following table lists the Bitwise operators supported by C. Assume variable 'A' holds 60 and variable 'B' holds 13, then − Try the following example to understand all the bitwise operators available in C − #include <stdio.h> main() { unsigned int a = 60; /* 60 = 0011 1100 */ unsigned int b = 13; /* 13 = 0...
[ { "code": null, "e": 2211, "s": 2084, "text": "The following table lists the Bitwise operators supported by C. Assume variable 'A' holds 60 and variable 'B' holds 13, then −" }, { "code": null, "e": 2294, "s": 2211, "text": "Try the following example to understand all the bitwise...
Backtracking to find all subsets - GeeksforGeeks
10 Feb, 2022 Given a set of positive integers, find all its subsets. Examples: Input: array = {1, 2, 3} Output: // this space denotes null element. 1 1 2 1 2 3 1 3 2 2 3 3 Explanation: These are all the subsets that can be formed using the array. Input...
[ { "code": null, "e": 24896, "s": 24868, "text": "\n10 Feb, 2022" }, { "code": null, "e": 24964, "s": 24896, "text": "Given a set of positive integers, find all its subsets. Examples: " }, { "code": null, "e": 25330, "s": 24964, "text": "Input: array = {1, 2, ...
Data science classification for mobile app malware | Towards Data Science
TL;DR: Bad guys abuse permissions and outdated software to infect your devices. At the time of writing this piece, Apple Inc. and Epic Games, Inc. are in the throes of a legal dispute. Epic Games claims that Apple’s App Store is a monopoly, and should not have control over in-app purchases. Apple countersued Epic and a...
[ { "code": null, "e": 252, "s": 172, "text": "TL;DR: Bad guys abuse permissions and outdated software to infect your devices." }, { "code": null, "e": 657, "s": 252, "text": "At the time of writing this piece, Apple Inc. and Epic Games, Inc. are in the throes of a legal dispute. E...
Boundary Value Test Cases, Robust Cases and Worst Case Test Cases - GeeksforGeeks
29 May, 2020 Generate boundary Value analysis, robust and worst-case test case for the program to find the median of three numbers. Its input is a triple of positive integers (say x, y, and z) and the minimum value can be 100 and maximum can be 500. Median of three numbers is the middle number when all three numbers ar...
[ { "code": null, "e": 24291, "s": 24263, "text": "\n29 May, 2020" }, { "code": null, "e": 24528, "s": 24291, "text": "Generate boundary Value analysis, robust and worst-case test case for the program to find the median of three numbers. Its input is a triple of positive integers (...
Difference between Seek Time and Disk Access Time in Disk Scheduling - GeeksforGeeks
01 Apr, 2020 Seek Time:A disk is divided into many circular tracks. Seek Time is defined as the time required by the read/write head to move from one track to another. Example,Consider the following diagram, the read/write head is currently on track 1. Now, on the next read/write request, we may want to read data from ...
[ { "code": null, "e": 24492, "s": 24464, "text": "\n01 Apr, 2020" }, { "code": null, "e": 24647, "s": 24492, "text": "Seek Time:A disk is divided into many circular tracks. Seek Time is defined as the time required by the read/write head to move from one track to another." }, ...
How to Count Unique Values in Excel? - GeeksforGeeks
17 Dec, 2021 We often need to report the Unique number of customers purchased, the number of products in our stock, List of regions our business covered. In this article, we explain how to count unique values in an excel column. Sample Data: We have given sample data with two fields Customer and Products purchased. ...
[ { "code": null, "e": 26289, "s": 26261, "text": "\n17 Dec, 2021" }, { "code": null, "e": 26432, "s": 26289, "text": "We often need to report the Unique number of customers purchased, the number of products in our stock, List of regions our business covered. " }, { "code"...
Number of balanced bracket expressions that can be formed from a string - GeeksforGeeks
25 May, 2021 Given a string str comprising of characters (, ), {, }, [, ] and ?. The task is to find the total number of balanced bracket expressions formed when ? can be replaced with any of the bracket characters. Here are some examples of balanced bracket expressions: {([])}, {()}[{}] etc. And, unbalanced bracket ex...
[ { "code": null, "e": 26045, "s": 26017, "text": "\n25 May, 2021" }, { "code": null, "e": 26386, "s": 26045, "text": "Given a string str comprising of characters (, ), {, }, [, ] and ?. The task is to find the total number of balanced bracket expressions formed when ? can be repla...
bokeh.plotting.figure.diamond() function in Python - GeeksforGeeks
28 Jul, 2020 Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, HTML and server. Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with default ax...
[ { "code": null, "e": 25537, "s": 25509, "text": "\n28 Jul, 2020" }, { "code": null, "e": 25869, "s": 25537, "text": "Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like ...
How to get the structure of a given DataFrame in R? - GeeksforGeeks
26 Mar, 2021 In this article, we will see how to get the structure of a DataFrame in R programming. Steps for Getting Structure of DataFrame: Create dataframe. The size of each vector should be the same. Follow the syntax while creating data frames. Function Used: To get the structure of a data frame we use a built-in ...
[ { "code": null, "e": 26511, "s": 26483, "text": "\n26 Mar, 2021" }, { "code": null, "e": 26598, "s": 26511, "text": "In this article, we will see how to get the structure of a DataFrame in R programming." }, { "code": null, "e": 26640, "s": 26598, "text": "Ste...
Maximal Disjoint Intervals - GeeksforGeeks
30 Aug, 2021 Given a set of N intervals, the task is to find the maximal set of mutually disjoint intervals. Two intervals [i, j] & [k, l] are said to be disjoint if they do not have any point in common. Examples: Input: intervals[][] = {{1, 4}, {2, 3}, {4, 6}, {8, 9}} Output: [2, 3] [4, 6] [8, 9] Intervals sorted w...
[ { "code": null, "e": 26157, "s": 26129, "text": "\n30 Aug, 2021" }, { "code": null, "e": 26349, "s": 26157, "text": "Given a set of N intervals, the task is to find the maximal set of mutually disjoint intervals. Two intervals [i, j] & [k, l] are said to be disjoint if they do no...
Implementation of Perceptron Algorithm for NAND Logic Gate with 2-bit Binary Input - GeeksforGeeks
08 Jul, 2020 In the field of Machine Learning, the Perceptron is a Supervised Learning Algorithm for binary classifiers. The Perceptron Model implements the following function: For a particular choice of the weight vector and bias parameter , the model predicts output for the corresponding input vector . NAND lo...
[ { "code": null, "e": 26839, "s": 26811, "text": "\n08 Jul, 2020" }, { "code": null, "e": 27003, "s": 26839, "text": "In the field of Machine Learning, the Perceptron is a Supervised Learning Algorithm for binary classifiers. The Perceptron Model implements the following function:...
Materialize CSS Navbars - GeeksforGeeks
10 Jul, 2020 A navigation bar is a user interface element within a webpage that contains links to other sections of the website. It is displayed as a list of horizontal links at the top of each page. It is placed before the main content of the page or below the header. The navbar is contained in an HTML5 <nav> followed...
[ { "code": null, "e": 29291, "s": 29263, "text": "\n10 Jul, 2020" }, { "code": null, "e": 29788, "s": 29291, "text": "A navigation bar is a user interface element within a webpage that contains links to other sections of the website. It is displayed as a list of horizontal links a...
Histogram in R using ggplot2 - GeeksforGeeks
25 Feb, 2021 ggplot2 is an R Package that is dedicated to Data visualization. ggplot2 Package Improve the quality and the beauty (aesthetics ) of the graph. By Using ggplot2 we can make almost every kind of graph In RStudio A histogram is an approximate representation of the distribution of numerical data. In a histo...
[ { "code": null, "e": 26585, "s": 26554, "text": " \n25 Feb, 2021\n" }, { "code": null, "e": 26797, "s": 26585, "text": "ggplot2 is an R Package that is dedicated to Data visualization. ggplot2 Package Improve the quality and the beauty (aesthetics ) of the graph. By Using ggplot...
ML | Ridge Regressor using sklearn - GeeksforGeeks
20 Oct, 2021 A Ridge regressor is basically a regularized version of a Linear Regressor. i.e to the original cost function of linear regressor we add a regularized term that forces the learning algorithm to fit the data and helps to keep the weights lower as possible. The regularized term has the parameter ‘alpha’ whic...
[ { "code": null, "e": 25975, "s": 25947, "text": "\n20 Oct, 2021" }, { "code": null, "e": 26415, "s": 25975, "text": "A Ridge regressor is basically a regularized version of a Linear Regressor. i.e to the original cost function of linear regressor we add a regularized term that fo...
Python | Alternate range slicing in list - GeeksforGeeks
29 Mar, 2019 List slicing is quite common utility in Python, one can easily slice certain elements from a list, but sometimes, we need to perform that task in non-contiguous manner and slice alternate ranges. Let’s discuss how this particular problem can be solved. Method #1 : Using list comprehensionList comprehension...
[ { "code": null, "e": 25607, "s": 25579, "text": "\n29 Mar, 2019" }, { "code": null, "e": 25860, "s": 25607, "text": "List slicing is quite common utility in Python, one can easily slice certain elements from a list, but sometimes, we need to perform that task in non-contiguous ma...
C# Program to Generate Marksheet of Student - GeeksforGeeks
16 Oct, 2021 Given the marks of the students, now we generate a mark sheet of students by calculating three subject marks of students by entering student names and roll numbers. Example: Input: Enter Student Roll-Number: 1 Enter Student Name: manoj Enter Subject-1 Marks :90 Enter Subject-2 Marks :78 Enter Subject-3 Mar...
[ { "code": null, "e": 25547, "s": 25519, "text": "\n16 Oct, 2021" }, { "code": null, "e": 25712, "s": 25547, "text": "Given the marks of the students, now we generate a mark sheet of students by calculating three subject marks of students by entering student names and roll numbers...
Asynchronous Functions and the Node.js Event Loop - GeeksforGeeks
14 Oct, 2021 Asynchronous Functions Everyone knows JavaScript is asynchronous in nature and so is the Node. The fundamental principle behind Node is that an application is executed on a single thread or process and the events are thus handled asynchronously. If we consider any typical web server like Apache, it require...
[ { "code": null, "e": 26089, "s": 26061, "text": "\n14 Oct, 2021" }, { "code": null, "e": 26112, "s": 26089, "text": "Asynchronous Functions" }, { "code": null, "e": 26335, "s": 26112, "text": "Everyone knows JavaScript is asynchronous in nature and so is the N...
Group all occurrences of characters according to first appearance - GeeksforGeeks
26 Aug, 2019 Given a string of lowercase characters, the task is to print the string in a manner such that a character comes first in string displays first with all its occurrences in string. Examples: Input : str = "geeksforgeeks" Output: ggeeeekkssfor Explanation: In the given string 'g' comes first and occurs 2 ti...
[ { "code": null, "e": 26519, "s": 26491, "text": "\n26 Aug, 2019" }, { "code": null, "e": 26698, "s": 26519, "text": "Given a string of lowercase characters, the task is to print the string in a manner such that a character comes first in string displays first with all its occurre...
numpy.argpartition() in Python - GeeksforGeeks
28 Dec, 2018 numpy.argpartition() function is used to create a indirect partitioned copy of input array with its elements rearranged in such a way that the value of the element in k-th position is in the position it would be in a sorted array. All elements smaller than the k-th element are moved before this element and...
[ { "code": null, "e": 25373, "s": 25345, "text": "\n28 Dec, 2018" }, { "code": null, "e": 25892, "s": 25373, "text": "numpy.argpartition() function is used to create a indirect partitioned copy of input array with its elements rearranged in such a way that the value of the element...
Kruskal's Minimum Spanning Tree using STL in C++ - GeeksforGeeks
11 Nov, 2021 Given an undirected, connected and weighted graph, find Minimum Spanning Tree (MST) of the graph using Kruskal’s algorithm. Input : Graph as an array of edges Output : Edges of MST are 6 - 7 2 - 8 5 - 6 0 - 1 2 - 5 2 - 3 0 - 7 ...
[ { "code": null, "e": 26337, "s": 26309, "text": "\n11 Nov, 2021" }, { "code": null, "e": 26461, "s": 26337, "text": "Given an undirected, connected and weighted graph, find Minimum Spanning Tree (MST) of the graph using Kruskal’s algorithm." }, { "code": null, "e": 26...
Reorder Facets in ggplot2 Plot in R - GeeksforGeeks
31 Aug, 2021 In this article, we will be looking at an approach to reorder the facets in the ggplot2 plot in R programming language. To reorder the facets accordingly of the given ggplot2 plot, the user needs to reorder the levels of our grouping variable accordingly with the help of the levels function and required pa...
[ { "code": null, "e": 26487, "s": 26459, "text": "\n31 Aug, 2021" }, { "code": null, "e": 26607, "s": 26487, "text": "In this article, we will be looking at an approach to reorder the facets in the ggplot2 plot in R programming language." }, { "code": null, "e": 26914,...
Longest Common Prefix using Sorting - GeeksforGeeks
27 Apr, 2021 Problem Statement: Given a set of strings, find the longest common prefix.Examples: Input: {"geeksforgeeks", "geeks", "geek", "geezer"} Output: "gee" Input: {"apple", "ape", "april"} Output: "ap" The longest common prefix for an array of strings is the common prefix between 2 most dissimilar strings. ...
[ { "code": null, "e": 25833, "s": 25805, "text": "\n27 Apr, 2021" }, { "code": null, "e": 25919, "s": 25833, "text": "Problem Statement: Given a set of strings, find the longest common prefix.Examples: " }, { "code": null, "e": 26032, "s": 25919, "text": "Inpu...
Set the innerHTML with JavaScript
The correct syntax to set the innerHTML is as follows − document.getElementById(“yourIdName”).innerHTML=”yourValue”; Let’s now see how to set the innerHTML − Live Demo <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initialscale=1.0"> <title>Document</t...
[ { "code": null, "e": 1118, "s": 1062, "text": "The correct syntax to set the innerHTML is as follows −" }, { "code": null, "e": 1179, "s": 1118, "text": "document.getElementById(“yourIdName”).innerHTML=”yourValue”;" }, { "code": null, "e": 1220, "s": 1179, "te...
Fortran - Cycle Statement
The cycle statement causes the loop to skip the remainder of its body, and immediately retest its condition prior to reiterating. program cycle_example implicit none integer :: i do i = 1, 20 if (i == 5) then cycle end if print*...
[ { "code": null, "e": 2276, "s": 2146, "text": "The cycle statement causes the loop to skip the remainder of its body, and immediately retest its condition prior to reiterating." }, { "code": null, "e": 2518, "s": 2276, "text": "program cycle_example \nimplicit none \n\n ...
Swap two numbers in C#
To swap two numbers, work with the following logic. Set two variables for swapping − val1 = 100; val2 = 200; Now perform the following operation for swap − val1 = val1 + val2; val2 = val1 - val2; val1 = val1 - val2; The following is the code − using System; namespace Demo { class Program { static void Main(str...
[ { "code": null, "e": 1114, "s": 1062, "text": "To swap two numbers, work with the following logic." }, { "code": null, "e": 1147, "s": 1114, "text": "Set two variables for swapping −" }, { "code": null, "e": 1171, "s": 1147, "text": "val1 = 100;\nval2 = 200;" ...
Removing Horizontal Lines in image (OpenCV, Python, Matplotlib)
To remove horizontal lines in an image, we can take the following steps − Read a local image. Convert the image from one color space to another. Apply a fixed-level threshold to each array element. Get a structuring element of the specified size and shape for morphological operations. Perform advanced morphological tra...
[ { "code": null, "e": 1136, "s": 1062, "text": "To remove horizontal lines in an image, we can take the following steps −" }, { "code": null, "e": 1156, "s": 1136, "text": "Read a local image." }, { "code": null, "e": 1207, "s": 1156, "text": "Convert the image...
Edit Distance | DP-5 - GeeksforGeeks
04 Mar, 2022 Given two strings str1 and str2 and below operations that can be performed on str1. Find minimum number of edits (operations) required to convert ‘str1’ into ‘str2’. InsertRemoveReplace Insert Remove Replace All of the above operations are of equal cost. Examples: Input: str1 = "geek", str2 = "gesek"...
[ { "code": null, "e": 34205, "s": 34177, "text": "\n04 Mar, 2022" }, { "code": null, "e": 34373, "s": 34205, "text": "Given two strings str1 and str2 and below operations that can be performed on str1. Find minimum number of edits (operations) required to convert ‘str1’ into ‘str2...
How to check if a character is upper-case in Python?
To check if a character is upper-case, we can simply use isupper() function call on the said character. print( 'Z'.isupper()) print( 'u'.isupper()) True False We can also check it using range based if conditions. def check_upper(c): if c >= 'A' and c <= 'Z': return True else: return False prin...
[ { "code": null, "e": 1167, "s": 1062, "text": "To check if a character is upper-case, we can simply use isupper() function call on the said character. " }, { "code": null, "e": 1211, "s": 1167, "text": "print( 'Z'.isupper())\nprint( 'u'.isupper())" }, { "code": null, ...
Difference between HashTable and ConcurrentHashMap in Java
Concurrent Hashmap is a class that was introduced in jdk1.5. Concurrent hash map applies locks only at bucket level called fragment while adding or updating the map. So, a concurrent hash map allows concurrent read and write operations to the map. HashTable is a thread-safe legacy class introduced in the Jdk1.1. It i...
[ { "code": null, "e": 1312, "s": 1062, "text": "Concurrent Hashmap is a class that was introduced in jdk1.5. Concurrent hash map applies locks only at bucket level called fragment while adding or updating the map. So, a concurrent hash map allows concurrent read and write operations to the map. " ...