title stringlengths 3 221 | text stringlengths 17 477k | parsed listlengths 0 3.17k |
|---|---|---|
Creating a Tensor in Pytorch | 04 Jul, 2021
All the deep learning is computations on tensors, which are generalizations of a matrix that can be indexed in more than 2 dimensions. Tensors can be created from Python lists with the torch.tensor() function.
To create tensors with Pytorch we can simply use the tensor() method:
Syntax:
torch.tensor(Data)... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n04 Jul, 2021"
},
{
"code": null,
"e": 238,
"s": 28,
"text": "All the deep learning is computations on tensors, which are generalizations of a matrix that can be indexed in more than 2 dimensions. Tensors can be created from Python lists... |
Set in Scala | Set-1 | 01 Feb, 2019
A set is a collection which only contains unique items. The uniqueness of a set are defined by the == method of the type that set holds. If you try to add a duplicate item in the set, then set quietly discard your request.Syntax:
// Immutable set
val variable_name: Set[type] = Set(item1, item2, item3)
or
v... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n01 Feb, 2019"
},
{
"code": null,
"e": 258,
"s": 28,
"text": "A set is a collection which only contains unique items. The uniqueness of a set are defined by the == method of the type that set holds. If you try to add a duplicate item in ... |
How to change row values based on a column value in R dataframe ? | 21 Apr, 2021
In this article, we will see how to change the values in rows based on the column values in Dataframe in R Programming Language.
Syntax: df[expression ,] <- newrowvalue
Arguments :
df – Data frame to simulate the modification upon
expression – Expression to evaluate the cell data based on a column value
n... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n21 Apr, 2021"
},
{
"code": null,
"e": 157,
"s": 28,
"text": "In this article, we will see how to change the values in rows based on the column values in Dataframe in R Programming Language."
},
{
"code": null,
"e": 197,
... |
Shuffle a deck of cards | 17 Apr, 2019
Given a deck of cards, the task is to shuffle them.
Asked in Amazon Interview
Prerequisite : Shuffle a given array
Algorithm:
1. First, fill the array with the values in order.
2. Go through the array and exchange each element
with the randomly chosen element in the range
from itself to the end.
/... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n17 Apr, 2019"
},
{
"code": null,
"e": 104,
"s": 52,
"text": "Given a deck of cards, the task is to shuffle them."
},
{
"code": null,
"e": 130,
"s": 104,
"text": "Asked in Amazon Interview"
},
{
"code": null,... |
String Comparison in Python | 25 Oct, 2020
Let us see how to compare Strings in Python.
Method 1: Using Relational Operators
The relational operators compare the Unicode values of the characters of the strings from the zeroth index till the end of the string. It then returns a boolean value according to the operator used.
Example:
“Geek” == “Geek”... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n25 Oct, 2020"
},
{
"code": null,
"e": 99,
"s": 53,
"text": "Let us see how to compare Strings in Python. "
},
{
"code": null,
"e": 136,
"s": 99,
"text": "Method 1: Using Relational Operators"
},
{
"code": nu... |
Classful Vs Classless Addressing | 03 Nov, 2021
Classful Addressing: Introduced in 1981, with classful routing, IP v4 addresses were divided into 5 classes(A to E).
Classes A-C: unicast addresses
Class D: multicast addresses
Class E: reserved for future use
Class A : In a class A address, the first bit of the first octet is always ‘0’. Thus, class A ... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n03 Nov, 2021"
},
{
"code": null,
"e": 173,
"s": 54,
"text": "Classful Addressing: Introduced in 1981, with classful routing, IP v4 addresses were divided into 5 classes(A to E). "
},
{
"code": null,
"e": 267,
"s": 173,... |
HTTP headers | User-Agent | 11 Oct, 2019
The HTTP headers User-Agent is a request header that allows a characteristic string that allows network protocol peers to identify the Operating System and Browser of the web-server. Your browser sends the user agent to every website you connect to. There is no conventional way of writing a user agent stri... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n11 Oct, 2019"
},
{
"code": null,
"e": 722,
"s": 28,
"text": "The HTTP headers User-Agent is a request header that allows a characteristic string that allows network protocol peers to identify the Operating System and Browser of the web-... |
C# | Dictionary.Clear Method | 01 Feb, 2019
This method is used to remove all key/value pairs from the Dictionary<TKey,TValue>.
Syntax:
public void Clear ();
Below are the programs to illustrate the use of above-discussed method:
Example 1:
// C# code to remove all pairs// from Dictionaryusing System;using System.Collections.Generic; class GFG { ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n01 Feb, 2019"
},
{
"code": null,
"e": 112,
"s": 28,
"text": "This method is used to remove all key/value pairs from the Dictionary<TKey,TValue>."
},
{
"code": null,
"e": 120,
"s": 112,
"text": "Syntax:"
},
{
... |
Matplotlib.pyplot.xlabels() in Python | 12 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface.
The xlabel() function in pyplot module of matplotlib library is used to set the label for the x-axis..
Syntax: m... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n12 Apr, 2020"
},
{
"code": null,
"e": 247,
"s": 52,
"text": "Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MA... |
Greater on right side | Practice | GeeksforGeeks | You are given an array Arr of size N. Replace every element with the next greatest element (greatest element on its right side) in the array. Also, since there is no element next to the last element, replace it with -1.
Example 1:
Input:
N = 6
Arr[] = {16, 17, 4, 3, 5, 2}
Output:
17 5 5 5 2 -1
Explanation: For 16 the g... | [
{
"code": null,
"e": 446,
"s": 226,
"text": "You are given an array Arr of size N. Replace every element with the next greatest element (greatest element on its right side) in the array. Also, since there is no element next to the last element, replace it with -1."
},
{
"code": null,
"e"... |
How to set cursor position in content-editable element using JavaScript ? | 28 Nov, 2019
In order to set caret cursor position in content editable elements like div tag is carried over by JavaScript Range interface. The range is created using document.createRange() method.
Approach 1:
First, create Range and set position using above syntax.
Get user input from input tag using jQuery$("input']"... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n28 Nov, 2019"
},
{
"code": null,
"e": 213,
"s": 28,
"text": "In order to set caret cursor position in content editable elements like div tag is carried over by JavaScript Range interface. The range is created using document.createRange(... |
Java Program to Write Bytes using ByteStream | 14 Sep, 2021
Java Byte streams are used to perform input and output of 8-bit bytes. To write Bytes using BytesStream to a file Java provides a specialized stream for writing files in the file system known as FileOutputStream. This stream provides the basic OutputStream functionality applied for writing the contents of ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n14 Sep, 2021"
},
{
"code": null,
"e": 343,
"s": 28,
"text": "Java Byte streams are used to perform input and output of 8-bit bytes. To write Bytes using BytesStream to a file Java provides a specialized stream for writing files in the f... |
Python | First Non-Empty String in list | 15 Mar, 2019
Sometimes while dealing with data science, we need to handle a large amount of data and hence we may require shorthands to perform certain tasks. We handle the Null values at preprocessing stage and hence sometimes require to check for the 1st valid element. Let’s discuss certain ways in which we can find ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n15 Mar, 2019"
},
{
"code": null,
"e": 363,
"s": 28,
"text": "Sometimes while dealing with data science, we need to handle a large amount of data and hence we may require shorthands to perform certain tasks. We handle the Null values at ... |
Overloading of Thread class run() method | 04 Oct, 2017
Overloading of run() method is possible. But Thread class start() method can invoke no-argument method. The other overloaded method we have to call explicitly like a normal method call.
// Java Program to illustrate the behavior of// run() method overloadingclass Geeks extends Thread { public void run()... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n04 Oct, 2017"
},
{
"code": null,
"e": 238,
"s": 52,
"text": "Overloading of run() method is possible. But Thread class start() method can invoke no-argument method. The other overloaded method we have to call explicitly like a normal m... |
Decision Making in Java (if, if-else, switch, break, continue, jump) | 31 Mar, 2022
Decision Making in programming is similar to decision-making in real life. In programming also face some situations where we want a certain block of code to be executed when some condition is fulfilled.
A programming language uses control statements to control the flow of execution of a program based on c... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n31 Mar, 2022"
},
{
"code": null,
"e": 256,
"s": 52,
"text": "Decision Making in programming is similar to decision-making in real life. In programming also face some situations where we want a certain block of code to be executed when ... |
Python | Scipy integrate.cumtrapz() method | 23 Jan, 2020
With the help of scipy.integrate.cumtrapz() method, we can get the cumulative integrated value of y(x) using composite trapezoidal rule by using scipy.integrate.cumtrapz() method.
Syntax : scipy.integrate.cumtrapz()Return : Return the cumulative integrated value of y(x).
Example #1 :In this example we can ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n23 Jan, 2020"
},
{
"code": null,
"e": 208,
"s": 28,
"text": "With the help of scipy.integrate.cumtrapz() method, we can get the cumulative integrated value of y(x) using composite trapezoidal rule by using scipy.integrate.cumtrapz() met... |
Graph measurements: length, distance, diameter, eccentricity, radius, center | 31 May, 2021
Prerequisite – Graph Theory Basics – Set 1, Set 2 A graph is defined as set of points known as ‘Vertices’ and line joining these points is known as ‘Edges’. It is a set consisting of where ‘V’ is vertices and ‘E’ is edge.
Vertices: {A, B, C, D, E, F} Edges: {{A, B}, {A, D}, {A, E}, {B, C}, {C, E}, {C, F... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n31 May, 2021"
},
{
"code": null,
"e": 275,
"s": 52,
"text": "Prerequisite – Graph Theory Basics – Set 1, Set 2 A graph is defined as set of points known as ‘Vertices’ and line joining these points is known as ‘Edges’. It is a set consi... |
Python Program For Rearranging An Array In Maximum Minimum Form – Set 2 (O(1) extra space) | 31 May, 2022
Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, third-second max, fourth-second min and so on. Examples:
Input: arr[] = {1, 2, 3, 4, 5, 6, 7} Output: arr[] = {7, 1, 6, 2, 5, 3, 4}Input: arr[] = {1, 2, 3, 4, 5, 6... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n31 May, 2022"
},
{
"code": null,
"e": 229,
"s": 28,
"text": "Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, third-second max, fourth-second... |
Convert Ternary Expression to a Binary Tree | 12 Jul, 2022
Given a string that contains ternary expressions. The expressions may be nested, task is convert the given ternary expression to a binary Tree.
Examples:
Input : string expression = a?b:c
Output : a
/ \
b c
Input : expression = a?b?c:d:e
Output : a
... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n12 Jul, 2022"
},
{
"code": null,
"e": 199,
"s": 54,
"text": "Given a string that contains ternary expressions. The expressions may be nested, task is convert the given ternary expression to a binary Tree. "
},
{
"code": null,
... |
Closures in Java with Examples | 26 Jul, 2021
A method is a collection of statements that perform some specific task and return the result to the caller. A method can perform some specific task without returning anything. Methods allow us to reuse the code without retyping the code. In Java, every method must be part of some class which is different f... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n26 Jul, 2021"
},
{
"code": null,
"e": 903,
"s": 28,
"text": "A method is a collection of statements that perform some specific task and return the result to the caller. A method can perform some specific task without returning anything.... |
Spring Data JPA – @Table Annotation | 29 Dec, 2021
Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Sp... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n29 Dec, 2021"
},
{
"code": null,
"e": 629,
"s": 28,
"text": "Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-read... |
C | Dynamic Memory Allocation | Question 7 | 28 Jun, 2021
What is the problem with following code?
#include<stdio.h>int main(){ int *p = (int *)malloc(sizeof(int)); p = NULL; free(p);}
(A) Compiler Error: free can’t be applied on NULL pointer(B) Memory Leak(C) Dangling Pointer(D) The program may crash as free() is called for NULL pointer.Answer: (B)E... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n28 Jun, 2021"
},
{
"code": null,
"e": 94,
"s": 53,
"text": "What is the problem with following code?"
},
{
"code": "#include<stdio.h>int main(){ int *p = (int *)malloc(sizeof(int)); p = NULL; free(p);}",
"e": 1... |
HTTP headers | Date | 18 Oct, 2019
Description:HTTP headers are used to pass additional information with HTTP response or HTTP request. Date HTTP header contains the date and time at which the message was generated. It is supported by all the browsers.
Syntax:
Date: day-name, day month year hour:minute:second GMT
Directives:
day-name: It is... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n18 Oct, 2019"
},
{
"code": null,
"e": 246,
"s": 28,
"text": "Description:HTTP headers are used to pass additional information with HTTP response or HTTP request. Date HTTP header contains the date and time at which the message was gener... |
Top 50 Software Engineering Interview Questions and Answers | 11 Nov, 2021
Software Engineering is indeed a must-to-go field for every individual who aspires to make a successful career as a Software Engineer, Software Developer, etc. in the IT industry. In simple words, it is concerned with the systematic and comprehensive study of designing, development, operations, and mainten... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n11 Nov, 2021"
},
{
"code": null,
"e": 763,
"s": 54,
"text": "Software Engineering is indeed a must-to-go field for every individual who aspires to make a successful career as a Software Engineer, Software Developer, etc. in the IT indu... |
Print calendar for a given year in C++ | 21 Jun, 2021
Prerequisite : Find day of the week for given dateProblem: To print the calendar of any given year. The program should be such that it can prints the calendar of any input year.Implementation:
CPP
// A C++ Program to Implement a Calendar// of an year#include<bits/stdc++.h>using namespace std; /*A Functio... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n21 Jun, 2021"
},
{
"code": null,
"e": 249,
"s": 54,
"text": "Prerequisite : Find day of the week for given dateProblem: To print the calendar of any given year. The program should be such that it can prints the calendar of any input ye... |
HTML5 Game Development | Infinitely Scrolling Background | 31 May, 2022
Game Design and Development is an emerging industry. Although making AAA titles will require advanced knowledge of game engines, DirectX, OpenGL, etc. small HTML5 video game projects is a good place to start.
HTML5 canvas and javascript can be used to make small games while learning the fundamentals of gam... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n31 May, 2022"
},
{
"code": null,
"e": 261,
"s": 52,
"text": "Game Design and Development is an emerging industry. Although making AAA titles will require advanced knowledge of game engines, DirectX, OpenGL, etc. small HTML5 video game ... |
Python | PRAW – Python Reddit API Wrapper | 09 Aug, 2021
PRAW (Python Reddit API Wrapper) is a Python module that provides a simple access to Reddit’s API. PRAW is easy to use and follows all of Reddit’s API rules.The documentation regarding PRAW is located here.Prerequisites:
Basic Python Programming Skills
Basic Reddit Knowledge : Reddit is a network of comm... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n09 Aug, 2021"
},
{
"code": null,
"e": 251,
"s": 28,
"text": "PRAW (Python Reddit API Wrapper) is a Python module that provides a simple access to Reddit’s API. PRAW is easy to use and follows all of Reddit’s API rules.The documentation ... |
Second largest element in BST | 21 May, 2021
Given a Binary Search Tree(BST), find the second largest element. Examples:
Input: Root of below BST
10
/
5
Output: 5
Input: Root of below BST
10
/ \
5 20
\
30
Output: 20
Source: Microsoft Interview
The idea is similar to below post. K... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n21 May, 2021"
},
{
"code": null,
"e": 130,
"s": 52,
"text": "Given a Binary Search Tree(BST), find the second largest element. Examples: "
},
{
"code": null,
"e": 294,
"s": 130,
"text": "Input: Root of below BST\n ... |
SWING - JLabel Class | The class JLabel can display either text, an image, or both. Label's contents are aligned by setting the vertical and horizontal alignment in its display area. By default, labels are vertically centered in their display area. Text-only labels are leading edge aligned, by default; image-only labels are horizontally cent... | [
{
"code": null,
"e": 2235,
"s": 1897,
"text": "The class JLabel can display either text, an image, or both. Label's contents are aligned by setting the vertical and horizontal alignment in its display area. By default, labels are vertically centered in their display area. Text-only labels are leadin... |
Python | sympy.Mod() method | 02 Aug, 2019
With the help of sympy.Mod() method, we can find the modulus and can give the parameters separately by using sympy.Mod() method.
Syntax : sympy.Mod(var1, var2)Return : Return a value of modulo.
Example #1 :In this example we can see that by using sympy.Mod() method, we are able to find the modulus for a gi... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n02 Aug, 2019"
},
{
"code": null,
"e": 157,
"s": 28,
"text": "With the help of sympy.Mod() method, we can find the modulus and can give the parameters separately by using sympy.Mod() method."
},
{
"code": null,
"e": 222,
... |
Backward iteration in Python | 04 Jul, 2022
The iteration of numbers is done by looping techniques in Python. There are many techniques in Python which facilitate looping. Sometimes we require to perform the looping backward and having shorthands to do so can be quite useful. Let’s discuss certain ways in which this can be done.
Method #1 : Using re... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n04 Jul, 2022"
},
{
"code": null,
"e": 339,
"s": 52,
"text": "The iteration of numbers is done by looping techniques in Python. There are many techniques in Python which facilitate looping. Sometimes we require to perform the looping ba... |
Java Virtual Machine (JVM) Stack Area | 20 Jun, 2021
For every thread, JVM creates a separate stack at the time of thread creation. The memory for a Java Virtual Machine stack does not need to be contiguous. The Java virtual machine only performs two operations directly on Java stacks: it pushes and pops frames. And stack for a particular thread may be terme... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n20 Jun, 2021"
},
{
"code": null,
"e": 997,
"s": 54,
"text": "For every thread, JVM creates a separate stack at the time of thread creation. The memory for a Java Virtual Machine stack does not need to be contiguous. The Java virtual ma... |
Bayesian logistic regression with PyMC3 | by Tung T. Nguyen | Towards Data Science | This is another article in a series of articles (see here and here for the other relevant articles) on probabilistic programming in general and PyMC3 in particular. In our previous articles, we explained how PyMC3 helps with statistical inference. In this article, we will solve a classification problem from end to end ... | [
{
"code": null,
"e": 608,
"s": 171,
"text": "This is another article in a series of articles (see here and here for the other relevant articles) on probabilistic programming in general and PyMC3 in particular. In our previous articles, we explained how PyMC3 helps with statistical inference. In this... |
Asynchronous and Synchronous Callbacks in Java - GeeksforGeeks | 13 Aug, 2019
A CallBack Function is a function that is passed into another function as an argument and is expected to execute after some kind of event. The purpose of the callback function is to inform a class Sync/Async if some work in another class is done. This is very useful when working with Asynchronous tasks. Su... | [
{
"code": null,
"e": 24560,
"s": 24532,
"text": "\n13 Aug, 2019"
},
{
"code": null,
"e": 25119,
"s": 24560,
"text": "A CallBack Function is a function that is passed into another function as an argument and is expected to execute after some kind of event. The purpose of the callb... |
Maximum sum rectangle in a 2D matrix | A matrix is given. We need to find a rectangle (sometimes square) matrix, whose sum is maximum.
The idea behind this algorithm is to fix the left and right columns and try to find the sum of the element from the left column to right column for each row, and store it temporarily. We will try to find top and bottom row n... | [
{
"code": null,
"e": 1158,
"s": 1062,
"text": "A matrix is given. We need to find a rectangle (sometimes square) matrix, whose sum is maximum."
},
{
"code": null,
"e": 1536,
"s": 1158,
"text": "The idea behind this algorithm is to fix the left and right columns and try to find th... |
ViewPager2 in Android with Example - GeeksforGeeks | 15 May, 2021
Before going to Viewpager2 let us know about Viewpager. Most of you have used WhatsApp, when you open WhatsApp you can see at the top, there are four sections Camera, Chats, Status, Calls these are the Viewpager. So a Viewpager is an android widget that is used to navigate from one page to another page by ... | [
{
"code": null,
"e": 25939,
"s": 25911,
"text": "\n15 May, 2021"
},
{
"code": null,
"e": 26469,
"s": 25939,
"text": "Before going to Viewpager2 let us know about Viewpager. Most of you have used WhatsApp, when you open WhatsApp you can see at the top, there are four sections Came... |
JavaScript Number toPrecision( ) Method - GeeksforGeeks | 22 Dec, 2021
Below is the example of the Number toPrecision( ) Method.
Example: <script type="text/javascript"> var num=213.45689; document.write(num.toPrecision(3)); </script>
<script type="text/javascript"> var num=213.45689; document.write(num.toPrecision(3)); </script>
O... | [
{
"code": null,
"e": 24850,
"s": 24822,
"text": "\n22 Dec, 2021"
},
{
"code": null,
"e": 24908,
"s": 24850,
"text": "Below is the example of the Number toPrecision( ) Method."
},
{
"code": null,
"e": 25036,
"s": 24908,
"text": "Example: <script type=\"t... |
GATE | GATE-CS-2003 | Question 21 - GeeksforGeeks | 15 Nov, 2018
Consider the following graph,
Among the following sequences:
(I) a b e g h f
(II) a b f e h g
(III) a b f h g e
(IV) a f g h b e
Which are depth first traversals of the above graph?(A) I, II and IV only(B) I and IV only(C) II, III and IV only(D) I, III and IV onlyAnswer: (D)Explanation: DFS of a graph
... | [
{
"code": null,
"e": 25885,
"s": 25857,
"text": "\n15 Nov, 2018"
},
{
"code": null,
"e": 25915,
"s": 25885,
"text": "Consider the following graph,"
},
{
"code": null,
"e": 25946,
"s": 25915,
"text": "Among the following sequences:"
},
{
"code": null,
... |
Hexadecimal Number System
| Hexadecimal Number System is one the type of Number Representation techniques, in which there value of base is 16. That means there are only 16 symbols or possible digit values, there are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Where A, B, C, D, E and F are single bit representations of decimal value 10, 11, 12... | [
{
"code": null,
"e": 1558,
"s": 1062,
"text": "Hexadecimal Number System is one the type of Number Representation techniques, in which there value of base is 16. That means there are only 16 symbols or possible digit values, there are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Where A, B, C, D,... |
Create a Bar chart using Recharts in ReactJS - GeeksforGeeks | 27 Jul, 2021
Introduction: Rechart JS is a library that is used for creating charts for React JS. This library is used for building Line charts, Bar charts, Pie charts, etc, with the help of React and D3 (Data-Driven Documents).
To create Bar Chart using Recharts, we create a dataset with x and y coordinate details.... | [
{
"code": null,
"e": 24379,
"s": 24348,
"text": " \n27 Jul, 2021\n"
},
{
"code": null,
"e": 24597,
"s": 24379,
"text": "Introduction: Rechart JS is a library that is used for creating charts for React JS. This library is used for building Line charts, Bar charts, Pie charts, etc,... |
Fibonacci Iterative Program in C | RecursionDemo.c
#include <stdio.h>
int factorial(int n) {
//base case
if(n == 0) {
return 1;
} else {
return n * factorial(n-1);
}
}
int fibbonacci(int n) {
if(n == 0) {
return 0;
} else if(n == 1) {
return 1;
} else {
return (fibbonacci(n-1) + fibbonacci(n-2));
}... | [
{
"code": null,
"e": 2596,
"s": 2580,
"text": "RecursionDemo.c"
},
{
"code": null,
"e": 3105,
"s": 2596,
"text": "#include <stdio.h>\n\nint factorial(int n) {\n //base case\n if(n == 0) {\n return 1;\n } else {\n return n * factorial(n-1);\n }\n}\n\nint fibbonac... |
How to Deploy your Dash App on Heroku | by François St-Amant | Towards Data Science | You just spent weeks developing your Dash app. It now looks great and you want the world to see it? This tutorial will show you how to do just that using Heroku.
Heroku is a cloud application platform that allows you to run your apps, completely free of charge.
For this tutorial, you will need to install a few things:
... | [
{
"code": null,
"e": 333,
"s": 171,
"text": "You just spent weeks developing your Dash app. It now looks great and you want the world to see it? This tutorial will show you how to do just that using Heroku."
},
{
"code": null,
"e": 433,
"s": 333,
"text": "Heroku is a cloud applic... |
iOS - Labels | Labels are used for displaying static content, which consists of a single line or multiple lines.
textAlignment
textColor
text
numberOflines
lineBreakMode
-(void)addLabel {
UILabel *aLabel = [[UILabel alloc]initWithFrame:
CGRectMake(20, 200, 280, 80)];
aLabel.numberOfLines = 0;
aLabel.textColor = [UIColor b... | [
{
"code": null,
"e": 2189,
"s": 2091,
"text": "Labels are used for displaying static content, which consists of a single line or multiple lines."
},
{
"code": null,
"e": 2203,
"s": 2189,
"text": "textAlignment"
},
{
"code": null,
"e": 2213,
"s": 2203,
"text": ... |
Check loop in array according to given constraints - GeeksforGeeks | 07 Mar, 2022
Given an array arr[0..n-1] of positive and negative numbers we need to find if there is a cycle in array with given rules of movements. If a number at an i index is positive, then move arr[i]%n forward steps, i.e., next index to visit is (i + arr[i])%n. Conversely, if it’s negative, move backward arr[i]%n ... | [
{
"code": null,
"e": 26671,
"s": 26643,
"text": "\n07 Mar, 2022"
},
{
"code": null,
"e": 27131,
"s": 26671,
"text": "Given an array arr[0..n-1] of positive and negative numbers we need to find if there is a cycle in array with given rules of movements. If a number at an i index i... |
Energy consumption time series forecasting with python and LSTM deep learning model | by Eligijus Bujokas | Towards Data Science | The objective of this article is to present the reader with a class in python that has a very intuitive and easy input to model and predict time series data using deep learning. Ideally, the reader should be able to copy the code presented in this article or the GitHub repository, tailor it to his needs (add more layer... | [
{
"code": null,
"e": 545,
"s": 172,
"text": "The objective of this article is to present the reader with a class in python that has a very intuitive and easy input to model and predict time series data using deep learning. Ideally, the reader should be able to copy the code presented in this article... |
What is Memory Leak? How can we avoid? - GeeksforGeeks | 01 Aug, 2021
Memory leak occurs when programmers create a memory in heap and forget to delete it.
The consequences of memory leak is that it reduces the performance of the computer by reducing the amount of available memory. Eventually, in the worst case, too much of the available memory may become allocated and all o... | [
{
"code": null,
"e": 26497,
"s": 26469,
"text": "\n01 Aug, 2021"
},
{
"code": null,
"e": 26583,
"s": 26497,
"text": "Memory leak occurs when programmers create a memory in heap and forget to delete it. "
},
{
"code": null,
"e": 26917,
"s": 26583,
"text": "The ... |
Data Binding with ViewModel in Android - GeeksforGeeks | 27 Sep, 2021
Prerequisite:
ViewModel
DataBinding
What is the benefit of integrating data binding in ViewModel? Simply we can say, It provides easy communication between VIEW and its data (or can say View’s Data). As we know the Views are defined in XML files and the XML file are linked with their activity or fragment f... | [
{
"code": null,
"e": 26405,
"s": 26377,
"text": "\n27 Sep, 2021"
},
{
"code": null,
"e": 26419,
"s": 26405,
"text": "Prerequisite:"
},
{
"code": null,
"e": 26429,
"s": 26419,
"text": "ViewModel"
},
{
"code": null,
"e": 26441,
"s": 26429,
"t... |
jQuery | addClass() with Examples - GeeksforGeeks | 13 Feb, 2019
The addClass is an inbuilt method in jQuery which is used to add more property to each selected element. It can also be used to change the property of the selected element. This method can be used in two different ways:
1) By adding Class name directly:Here, Class name can be used directly with the element... | [
{
"code": null,
"e": 41992,
"s": 41964,
"text": "\n13 Feb, 2019"
},
{
"code": null,
"e": 42212,
"s": 41992,
"text": "The addClass is an inbuilt method in jQuery which is used to add more property to each selected element. It can also be used to change the property of the selected... |
How to Merge DataFrames Based on Multiple Columns in R? - GeeksforGeeks | 28 Nov, 2021
In this article, we will discuss how to merge dataframes based on multiple columns in R Programming Language.
We can merge two dataframes based on multiple columns by using merge() function
Syntax:
merge(dataframe1, dataframe2, by.x=c(‘column1’, ‘column2’...........,’column n’), by.y=c(‘column1’, ‘column... | [
{
"code": null,
"e": 26487,
"s": 26459,
"text": "\n28 Nov, 2021"
},
{
"code": null,
"e": 26597,
"s": 26487,
"text": "In this article, we will discuss how to merge dataframes based on multiple columns in R Programming Language."
},
{
"code": null,
"e": 26679,
"s": ... |
Nutanix Interview Experience | Set 1 (On-Campus for Internship) - GeeksforGeeks | 14 May, 2017
Nutanix visited my campus. There were 3 rounds in total:
Round 1 (coding round) :2 questions were to be solved in 1hr 15min.Question 1:Given a string determine whether it is a ‘sum-string’. A string is called a sum-string if it satisfies the following properties:len(s)>3sub-string(i,x) + sub-string(x+1,j) ... | [
{
"code": null,
"e": 26315,
"s": 26287,
"text": "\n14 May, 2017"
},
{
"code": null,
"e": 26372,
"s": 26315,
"text": "Nutanix visited my campus. There were 3 rounds in total:"
},
{
"code": null,
"e": 26808,
"s": 26372,
"text": "Round 1 (coding round) :2 questio... |
Hashmap vs WeakHashMap in Java - GeeksforGeeks | 29 Sep, 2021
HashMap
Java.util.HashMap class is a Hashing based implementation. In HashMap, we have a key and a value pair. Even though the object is specified as key in hashmap, it does not have any reference and it is not eligible for garbage collection if it is associated with HashMap i.e. HashMap dominates over Gar... | [
{
"code": null,
"e": 26235,
"s": 26207,
"text": "\n29 Sep, 2021"
},
{
"code": null,
"e": 26243,
"s": 26235,
"text": "HashMap"
},
{
"code": null,
"e": 26558,
"s": 26243,
"text": "Java.util.HashMap class is a Hashing based implementation. In HashMap, we have a k... |
Creating A Range Slider in HTML using JavaScript - GeeksforGeeks | 03 Dec, 2018
Range Sliders are used on web pages to allow the user specify a numeric value which must be no less than a given value, and no more than another given value. That is, it allows to choose value from a range which is represented as a slider.A Range slider is typically represented using a slider or dial contr... | [
{
"code": null,
"e": 25185,
"s": 25157,
"text": "\n03 Dec, 2018"
},
{
"code": null,
"e": 25701,
"s": 25185,
"text": "Range Sliders are used on web pages to allow the user specify a numeric value which must be no less than a given value, and no more than another given value. That ... |
Swapping two numbers using template function in C++ - GeeksforGeeks | 27 Dec, 2021
A significant benefit of object-oriented programming is the reusability of code which eliminates redundant coding. An important feature of C++ is called templates. Templates support generic programming, which allows to development of reusable software components such as functions, classes, etc., supporting... | [
{
"code": null,
"e": 25773,
"s": 25745,
"text": "\n27 Dec, 2021"
},
{
"code": null,
"e": 26125,
"s": 25773,
"text": "A significant benefit of object-oriented programming is the reusability of code which eliminates redundant coding. An important feature of C++ is called templates.... |
Merge k sorted linked lists | Set 2 (Using Min Heap) - GeeksforGeeks | 28 Mar, 2022
Given k linked lists each of size n and each list is sorted in non-decreasing order, merge them into a single sorted (non-decreasing order) linked list and print the sorted linked list as output.Examples:
Input: k = 3, n = 4
list1 = 1->3->5->7->NULL
list2 = 2->4->6->8->NULL
list3 = 0->9->10->11->NULL
Out... | [
{
"code": null,
"e": 25837,
"s": 25809,
"text": "\n28 Mar, 2022"
},
{
"code": null,
"e": 26042,
"s": 25837,
"text": "Given k linked lists each of size n and each list is sorted in non-decreasing order, merge them into a single sorted (non-decreasing order) linked list and print t... |
How to get the second-to-last element of a list in Python? | Python sequence, including list object allows indexing. Any element in list can be accessed using zero based index. If index is a negative number, count of index starts from end. As we want second to last element in list, use -2 as index.
>>> L1=[1,2,3,4,5]
>>> print (L1[-2])
4 | [
{
"code": null,
"e": 1302,
"s": 1062,
"text": "Python sequence, including list object allows indexing. Any element in list can be accessed using zero based index. If index is a negative number, count of index starts from end. As we want second to last element in list, use -2 as index."
},
{
... |
Chain of Responsibility Design Pattern - GeeksforGeeks | 24 Feb, 2022
Chain of responsibility pattern is used to achieve loose coupling in software design where a request from the client is passed to a chain of objects to process them. Later, the object in the chain will decide themselves who will be processing the request and whether the request is required to be sent to th... | [
{
"code": null,
"e": 24960,
"s": 24932,
"text": "\n24 Feb, 2022"
},
{
"code": null,
"e": 25366,
"s": 24960,
"text": "Chain of responsibility pattern is used to achieve loose coupling in software design where a request from the client is passed to a chain of objects to process the... |
exp() function C++ | The C / C++ library function double exp(double x) returns the value of e raised to the
xth power. Following is the declaration for exp() function.
double exp(double x)
The parameter is a floating point value. And this function returns the exponential
value of x.
Live Demo
#include <iostream>
#include <cmath>
using nam... | [
{
"code": null,
"e": 1209,
"s": 1062,
"text": "The C / C++ library function double exp(double x) returns the value of e raised to the\nxth power. Following is the declaration for exp() function."
},
{
"code": null,
"e": 1230,
"s": 1209,
"text": "double exp(double x)"
},
{
... |
LISP - Sequences | Sequence is an abstract data type in LISP. Vectors and lists are the two concrete subtypes of this data type. All the functionalities defined on sequence data type are actually applied on all vectors and list types.
In this section, we will discuss most commonly used functions on sequences.
Before starting on various w... | [
{
"code": null,
"e": 2276,
"s": 2060,
"text": "Sequence is an abstract data type in LISP. Vectors and lists are the two concrete subtypes of this data type. All the functionalities defined on sequence data type are actually applied on all vectors and list types."
},
{
"code": null,
"e": ... |
MomentJS - Subtract | Just like the add method, subtract allows to subtract days, months, hours, minutes, seconds etc., from a given date.
moment().subtract(Number, String);
moment().subtract(Duration);
moment().subtract(Object);
Observe the following example that shows how to use the subtract method −
<html>
<head>
<title>MomentJ... | [
{
"code": null,
"e": 2077,
"s": 1960,
"text": "Just like the add method, subtract allows to subtract days, months, hours, minutes, seconds etc., from a given date."
},
{
"code": null,
"e": 2169,
"s": 2077,
"text": "moment().subtract(Number, String);\nmoment().subtract(Duration);\... |
View Recycling in Android with ListView - GeeksforGeeks | 18 Feb, 2021
Memory management is a crucial aspect of app development. Since mobile devices have very limited memory, it is necessary to use it carefully in our applications. One of the best practices involved in doing so is “view recycling“.
This article is about view recycling in Android and then a simple app is crea... | [
{
"code": null,
"e": 24749,
"s": 24721,
"text": "\n18 Feb, 2021"
},
{
"code": null,
"e": 24979,
"s": 24749,
"text": "Memory management is a crucial aspect of app development. Since mobile devices have very limited memory, it is necessary to use it carefully in our applications. O... |
C | Structure & Union | Question 10 - GeeksforGeeks | 28 Jun, 2021
Predict the output of following C program
#include<stdio.h>struct Point{ int x, y, z;}; int main(){ struct Point p1 = {.y = 0, .z = 1, .x = 2}; printf("%d %d %d", p1.x, p1.y, p1.z); return 0;}
(A) Compiler Error(B) 2 0 1(C) 0 1 2(D) 2 1 0Answer: (B)Explanation: Refer designated Initialization discusse... | [
{
"code": null,
"e": 24362,
"s": 24334,
"text": "\n28 Jun, 2021"
},
{
"code": null,
"e": 24404,
"s": 24362,
"text": "Predict the output of following C program"
},
{
"code": "#include<stdio.h>struct Point{ int x, y, z;}; int main(){ struct Point p1 = {.y = 0, .z = 1, .x... |
ExpressJS - Templating | Pug is a templating engine for Express. Templating engines are used to remove the cluttering of our server code with HTML, concatenating strings wildly to existing HTML templates. Pug is a very powerful templating engine which has a variety of features including filters, includes, inheritance, interpolation, etc. There... | [
{
"code": null,
"e": 2419,
"s": 2061,
"text": "Pug is a templating engine for Express. Templating engines are used to remove the cluttering of our server code with HTML, concatenating strings wildly to existing HTML templates. Pug is a very powerful templating engine which has a variety of features ... |
Write a program to Delete a Tree - GeeksforGeeks | 18 Feb, 2022
To delete a tree, we must traverse all the nodes of the tree and delete them one by one. So, which traversal we should use – inorder transversal, preorder transversal, or the postorder transversal? The answer is simple. We should use the postorder transversal because before deleting the parent node, we sho... | [
{
"code": null,
"e": 24543,
"s": 24515,
"text": "\n18 Feb, 2022"
},
{
"code": null,
"e": 25192,
"s": 24543,
"text": "To delete a tree, we must traverse all the nodes of the tree and delete them one by one. So, which traversal we should use – inorder transversal, preorder transver... |
Comparing and Filtering NumPy array - GeeksforGeeks | 07 Apr, 2021
In this article, we are going to see how to perform a comparison and filtering of the NumPy array.
Let’s see the comparison operators that will be used in comparing NumPy Arrays –
Greater than (>) Or numpy.greater().
Less Than (<) numpy.less().
Equal(==) or numpy.equal()
Not Equal(!=) or numpy.not_equal().... | [
{
"code": null,
"e": 24292,
"s": 24264,
"text": "\n07 Apr, 2021"
},
{
"code": null,
"e": 24391,
"s": 24292,
"text": "In this article, we are going to see how to perform a comparison and filtering of the NumPy array."
},
{
"code": null,
"e": 24472,
"s": 24391,
... |
4 Different Ways to Efficiently Sort a Pandas DataFrame | by Byron Dolon | Towards Data Science | Sorting data properly can make it easy for you to understand it.
Many people turn to advanced indexing and aggregate functions in Pandas to answer questions at every stage of analysis. These features can be incredibly useful when you need to manipulate data. However, Pandas also offers different ways of sorting a DataF... | [
{
"code": null,
"e": 236,
"s": 171,
"text": "Sorting data properly can make it easy for you to understand it."
},
{
"code": null,
"e": 586,
"s": 236,
"text": "Many people turn to advanced indexing and aggregate functions in Pandas to answer questions at every stage of analysis. T... |
Powershell - Brackets | Powershell supports three types of brackets.
Parenthesis brackets. − ()
Parenthesis brackets. − ()
Braces brackets. − {}
Braces brackets. − {}
Square brackets. − []
Square brackets. − []
This type of brackets is used to
pass arguments
pass arguments
enclose multiple set of instructions
enclose multiple set of ... | [
{
"code": null,
"e": 2213,
"s": 2168,
"text": "Powershell supports three types of brackets."
},
{
"code": null,
"e": 2242,
"s": 2213,
"text": "Parenthesis brackets. − () \n"
},
{
"code": null,
"e": 2270,
"s": 2242,
"text": "Parenthesis brackets. − () "
},
... |
Program for n-th even number | 25 Oct, 2018
Given a number n, print the nth even number. The 1st even number is 2, 2nd is 4 and so on.
Examples:
Input : 3
Output : 6
First three even numbers are 2, 4, 6, ..
Input : 5
Output : 10
First five even numbers are 2, 4, 6, 8, 19..
The nth even number is given by the formula 2*n.
C++
Java
Python3
C#
PHP
//... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n25 Oct, 2018"
},
{
"code": null,
"e": 144,
"s": 53,
"text": "Given a number n, print the nth even number. The 1st even number is 2, 2nd is 4 and so on."
},
{
"code": null,
"e": 154,
"s": 144,
"text": "Examples:"
}... |
Number of ways to split N as sum of K numbers from the given range | 09 Aug, 2021
Given four positive integer N, K, L, and R, the task is to split N as sum of K numbers lying in the range [L, R].Note: Since the number of ways can be very large. Output answer modulo 1000000007.Examples:
Input : N = 12, K = 3, L = 1, R = 5 Output : 10 {2, 5, 5} {3, 4, 5} {3, 5, 4} {4, 3, 5} {4, 4, 4} {4,... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n09 Aug, 2021"
},
{
"code": null,
"e": 234,
"s": 28,
"text": "Given four positive integer N, K, L, and R, the task is to split N as sum of K numbers lying in the range [L, R].Note: Since the number of ways can be very large. Output answe... |
Concurrency Control Techniques | 07 Jul, 2022
Concurrency control is provided in a database to:
(i) enforce isolation among transactions.
(ii) preserve database consistency through consistency preserving execution of transactions.
(iii) resolve read-write and write-read conflicts.
Various concurrency control techniques are:
1. Two-phase locking Protoc... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n07 Jul, 2022"
},
{
"code": null,
"e": 104,
"s": 54,
"text": "Concurrency control is provided in a database to:"
},
{
"code": null,
"e": 146,
"s": 104,
"text": "(i) enforce isolation among transactions."
},
{
... |
Ruby | Time now() function | 07 Jan, 2020
The now() is an inbuilt method in Ruby returns the current time.
Syntax: time.now()
Parameters: The function accepts no parameter
Return Value: It returns the current time
Example 1:
# Ruby code for now() method # Include Timerequire 'time' # Declaring time a = Time.now() # Prints current time puts a
Ou... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n07 Jan, 2020"
},
{
"code": null,
"e": 93,
"s": 28,
"text": "The now() is an inbuilt method in Ruby returns the current time."
},
{
"code": null,
"e": 112,
"s": 93,
"text": "Syntax: time.now()"
},
{
"code": nu... |
Python | Converting all strings in list to integers | 29 Nov, 2018
Interconversion between data types is facilitated by python libraries quite easily. But the problem of converting the entire list of string to integers is quite common in development domain. Let’s discuss few ways to solve this particular problem.
Method #1 : Naive Method
This is most generic method that s... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n29 Nov, 2018"
},
{
"code": null,
"e": 302,
"s": 54,
"text": "Interconversion between data types is facilitated by python libraries quite easily. But the problem of converting the entire list of string to integers is quite common in dev... |
Sort ArrayList in Descending Order Using Comparator in Java | 11 Dec, 2020
Comparator is an interface that is used to rearrange the ArrayList in a sorted manner. Comparator is used to sort an ArrayList of User-defined objects. In java, a Comparator is provided in java.util package. Using Comparator sort ArrayList on the basis of multiple variables, or simply implement Comparator ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n11 Dec, 2020"
},
{
"code": null,
"e": 493,
"s": 28,
"text": "Comparator is an interface that is used to rearrange the ArrayList in a sorted manner. Comparator is used to sort an ArrayList of User-defined objects. In java, a Comparator i... |
Longest Path with Same Values in a Binary Tree | 08 Feb, 2022
Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root. The length of path between two nodes is represented by the number of edges between them.Examples:
Input :
2
/ \
7... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n08 Feb, 2022"
},
{
"code": null,
"e": 305,
"s": 52,
"text": "Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root. The length of path be... |
numpy.invert() in Python | 29 Nov, 2018
numpy.invert() function is used to Compute the bit-wise Inversion of an array element-wise. It computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays.
For signed integer inputs, the two’s complement is returned. In a two’s-complement system negative numbers ar... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n29 Nov, 2018"
},
{
"code": null,
"e": 226,
"s": 28,
"text": "numpy.invert() function is used to Compute the bit-wise Inversion of an array element-wise. It computes the bit-wise NOT of the underlying binary representation of the integer... |
Length of the largest subarray with contiguous elements | Set 1 | 23 Jun, 2022
Given an array of distinct integers, find length of the longest subarray which contains numbers that can be arranged in a continuous sequence.
Examples:
Input: arr[] = {10, 12, 11};
Output: Length of the longest contiguous subarray is 3
Input: arr[] = {14, 12, 11, 20};
Output: Length of the longest co... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n23 Jun, 2022"
},
{
"code": null,
"e": 198,
"s": 54,
"text": "Given an array of distinct integers, find length of the longest subarray which contains numbers that can be arranged in a continuous sequence. "
},
{
"code": null,
... |
Number of subsets with sum divisible by M | Set 2 | 13 May, 2021
Given an array arr[] of N integers and an integer M, the task is to find the number of non-empty subsequences such that the sum of the subsequence is divisible by M.
Examples:
Input: arr[] = {1, 2, 3}, M = 1 Output: 7 Number of non-empty subsets of this array are 7. Since m = 1, m will divide all the pos... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n13 May, 2021"
},
{
"code": null,
"e": 218,
"s": 52,
"text": "Given an array arr[] of N integers and an integer M, the task is to find the number of non-empty subsequences such that the sum of the subsequence is divisible by M."
},
... |
Valid variants of main() in Java | 11 May, 2022
We know that a Java code begins to execute from the main method. During runtime, if JVM can’t find any main method then we will get a runtime exception: No such Method Error:
Main method not found in class, please define the main method as:
public static void main(String[] args)
to avoid this problem th... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n11 May, 2022"
},
{
"code": null,
"e": 229,
"s": 52,
"text": "We know that a Java code begins to execute from the main method. During runtime, if JVM can’t find any main method then we will get a runtime exception: No such Method Error:... |
Quick way to check if all the characters of a string are same | 20 Jun, 2022
Given a string, check if all the characters of the string are the same or not.
Examples:
Input : s = "geeks"
Output : No
Input : s = "gggg"
Output : Yes
Simple Way
To find whether a string has all the same characters. Traverse the whole string from index 1 and check whether that character matches the fi... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n20 Jun, 2022"
},
{
"code": null,
"e": 132,
"s": 53,
"text": "Given a string, check if all the characters of the string are the same or not."
},
{
"code": null,
"e": 143,
"s": 132,
"text": "Examples: "
},
{
"... |
How to Perform Arithmetic Operation using Switch Case in PHP through HTML form ? | 05 Jun, 2021
We are going to perform the basic arithmetic operations like- addition, subtraction, multiplication, and division using PHP. We are using HTML form to take the input values and choose an option to perform particular operation using Switch Case.
Arithmetic Operations are used to perform operations like addi... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n05 Jun, 2021"
},
{
"code": null,
"e": 273,
"s": 28,
"text": "We are going to perform the basic arithmetic operations like- addition, subtraction, multiplication, and division using PHP. We are using HTML form to take the input values an... |
Draw Spiraling Star using Turtle in Python | 01 Aug, 2020
Turtle is an inbuilt module of python. It enables us to draw any drawing by a turtle and methods defined in the turtle module and by using some logical loops. To draw something on the screen(cardboard) just move the turtle(pen).To move turtle(pen) there are some functions i.e forward(), backward(), etcAppr... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n01 Aug, 2020"
},
{
"code": null,
"e": 402,
"s": 53,
"text": "Turtle is an inbuilt module of python. It enables us to draw any drawing by a turtle and methods defined in the turtle module and by using some logical loops. To draw somethi... |
Find the number of distinct islands in a 2D matrix | 11 Aug, 2021
Given a boolean 2D matrix. The task is to find the number of distinct islands where a group of connected 1s (horizontally or vertically) forms an island. Two islands are considered to be distinct if and only if one island is equal to another (not rotated or reflected).Examples:
Input: grid[][] = {{1, 1, 0... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n11 Aug, 2021"
},
{
"code": null,
"e": 332,
"s": 52,
"text": "Given a boolean 2D matrix. The task is to find the number of distinct islands where a group of connected 1s (horizontally or vertically) forms an island. Two islands are cons... |
How to sort a list in C# | List.Sort() Method Set -2 | 22 Sep, 2021
List<T>.Sort() Method is used to sort the elements or a portion of the elements in the List<T> using either the specified or default IComparer<T> implementation or a provided Comparison<T> delegate to compare list elements. There are total 4 methods in the overload list of this method as follows:
Sort(ICom... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n22 Sep, 2021"
},
{
"code": null,
"e": 326,
"s": 28,
"text": "List<T>.Sort() Method is used to sort the elements or a portion of the elements in the List<T> using either the specified or default IComparer<T> implementation or a provided ... |
Python | Pandas Series.round() | 12 Jun, 2021
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier.When doing mathematical operations on series, many times the returned series is having decimal... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n12 Jun, 2021"
},
{
"code": null,
"e": 487,
"s": 28,
"text": "Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes imp... |
Angular 8 - Animations | Animation gives the web application a refreshing look and rich user interaction. In HTML, animation is basically the transformation of HTML element from one CSS style to another over a specific period of time. For example, an image element can be enlarged by changing its width and height.
If the width and height of the... | [
{
"code": null,
"e": 2678,
"s": 2388,
"text": "Animation gives the web application a refreshing look and rich user interaction. In HTML, animation is basically the transformation of HTML element from one CSS style to another over a specific period of time. For example, an image element can be enlarg... |
Creating custom modules in Node.js | The node.js modules are a kind of package that contains certain functions or methods to be used by those who imports them. Some modules are present on the web to be used by developers such as fs, fs-extra, crypto, stream, etc. You can also make a package of your own and use it in your code.
exports.function_name = func... | [
{
"code": null,
"e": 1354,
"s": 1062,
"text": "The node.js modules are a kind of package that contains certain functions or methods to be used by those who imports them. Some modules are present on the web to be used by developers such as fs, fs-extra, crypto, stream, etc. You can also make a packag... |
How to read integers from a file using BufferedReader in Java? | The BufferedReader class of Java is used to read the stream of characters from the specified source (character-input stream). The constructor of this class accepts an InputStream object as a parameter.
This class provides a method known as readLine() which reads and returns the next line from the source and returns it ... | [
{
"code": null,
"e": 1264,
"s": 1062,
"text": "The BufferedReader class of Java is used to read the stream of characters from the specified source (character-input stream). The constructor of this class accepts an InputStream object as a parameter."
},
{
"code": null,
"e": 1400,
"s":... |
C - Data Types | Data types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.
The types in C can be classified as follows −
Basic Types
They are arithmetic types and are fu... | [
{
"code": null,
"e": 2310,
"s": 2084,
"text": "Data types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted."
},
{
"code": null,... |
How can I display an image using Pillow in Tkinter? | Python provides Pillow Package (PIL) to process and load the images in the application. An image can be loaded using the inbuilt Image.open("image location") method. Further, we can use a Label widget to display the Image in the window.
#Import tkinter library
from tkinter import *
from PIL import Image,ImageTk
#Create... | [
{
"code": null,
"e": 1299,
"s": 1062,
"text": "Python provides Pillow Package (PIL) to process and load the images in the application. An image can be loaded using the inbuilt Image.open(\"image location\") method. Further, we can use a Label widget to display the Image in the window."
},
{
... |
DW - Types | There are four types of Data Warehousing system.
Data Mart
Online Analytical Processing (OLAP)
Online Transactional Processing (OLTP)
Predictive Analysis (PA)
A Data Mart is known as the simplest form of a Data Warehouse system and normally consists of a single functional area in an organization like sales, finance or ... | [
{
"code": null,
"e": 2910,
"s": 2861,
"text": "There are four types of Data Warehousing system."
},
{
"code": null,
"e": 2920,
"s": 2910,
"text": "Data Mart"
},
{
"code": null,
"e": 2956,
"s": 2920,
"text": "Online Analytical Processing (OLAP)"
},
{
"c... |
How to get first day of week in PHP? | To get the first day of the week in PHP, the code is as follows −
Live Demo
<?php
$res = date('l - d/m/Y', strtotime("this week"));
echo "First day = ", $res;
?>
This will produce the following output −
First day = Monday - 09/12/2019
Let us now see another example −
Live Demo
<?php
echo "Displaying Sunday a... | [
{
"code": null,
"e": 1128,
"s": 1062,
"text": "To get the first day of the week in PHP, the code is as follows −"
},
{
"code": null,
"e": 1139,
"s": 1128,
"text": " Live Demo"
},
{
"code": null,
"e": 1231,
"s": 1139,
"text": "<?php\n $res = date('l - d/m/Y',... |
Understanding the n_jobs Parameter to Speedup scikit-learn Classification | by Angelica Lo Duca | Towards Data Science | In this tutorial I illustrate the importance of the n_jobs parameter provided by some classes of the scikit-learn library. According to the official scikit-learn library, the n_jobs parameter is described as follows:
The number of parallel jobs to run for neighbors search. None means 1 unless in a joblib.parallel_backe... | [
{
"code": null,
"e": 389,
"s": 172,
"text": "In this tutorial I illustrate the importance of the n_jobs parameter provided by some classes of the scikit-learn library. According to the official scikit-learn library, the n_jobs parameter is described as follows:"
},
{
"code": null,
"e": 5... |
Erlang - Exceptions | Exception handling is required in any programming language to handle the runtime errors so that normal flow of the application can be maintained. Exception normally disrupts the normal flow of the application, which is the reason why we need to use Exception handling in our application.
Normally when an exception or er... | [
{
"code": null,
"e": 2589,
"s": 2301,
"text": "Exception handling is required in any programming language to handle the runtime errors so that normal flow of the application can be maintained. Exception normally disrupts the normal flow of the application, which is the reason why we need to use Exce... |
C library function - getc() | The C library function int getc(FILE *stream) gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.
Following is the declaration for getc() function.
int getc(FILE *stream)
stream − This is the pointer to a FILE object that identifies the stream on whic... | [
{
"code": null,
"e": 2174,
"s": 2007,
"text": "The C library function int getc(FILE *stream) gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream."
},
{
"code": null,
"e": 2224,
"s": 2174,
"text": "Following is th... |
Special array reversal | Practice | GeeksforGeeks | Given a string S, containing special characters and all the alphabets, reverse the string without
affecting the positions of the special characters.
Example 1:
Input: S = "A&B"
Output: "B&A"
Explanation: As we ignore '&' and
then reverse, so answer is "B&A".
​Example 2:
Input: S = "A&x#
Output: "x&A#"
Explanation: ... | [
{
"code": null,
"e": 387,
"s": 238,
"text": "Given a string S, containing special characters and all the alphabets, reverse the string without\naffecting the positions of the special characters."
},
{
"code": null,
"e": 398,
"s": 387,
"text": "Example 1:"
},
{
"code": nul... |
Second most repeated string in a sequence | Practice | GeeksforGeeks | Given a sequence of strings, the task is to find out the second most repeated (or frequent) string in the given sequence.
Note: No two strings are the second most repeated, there will be always a single string.
Example 1:
Input:
N = 6
arr[] = {aaa, bbb, ccc, bbb, aaa, aaa}
Output: bbb
Explanation: "bbb" is the second m... | [
{
"code": null,
"e": 360,
"s": 238,
"text": "Given a sequence of strings, the task is to find out the second most repeated (or frequent) string in the given sequence."
},
{
"code": null,
"e": 449,
"s": 360,
"text": "Note: No two strings are the second most repeated, there will be... |
Apache Solr - Deleting Documents | To delete documents from the index of Apache Solr, we need to specify the ID’s of the documents to be deleted between the <delete></delete> tags.
<delete>
<id>003</id>
<id>005</id>
<id>004</id>
<id>002</id>
</delete>
Here, this XML code is used to delete the documents with ID’s 003 and 005. Save t... | [
{
"code": null,
"e": 2170,
"s": 2024,
"text": "To delete documents from the index of Apache Solr, we need to specify the ID’s of the documents to be deleted between the <delete></delete> tags."
},
{
"code": null,
"e": 2263,
"s": 2170,
"text": "<delete> \n <id>003</id> \n ... |
Simplified Forecasting with Facebook Prophet | by Josh Johnson | Towards Data Science | Timeseries forecasting is a complex art form. Many models are very sensitive to trends, cycles (called ‘seasons’) and changing magnitudes of fluctuations, and instead require stationary data, which lack these features.
This devastating disease has killed hundreds of thousands in the US and millions around the world and... | [
{
"code": null,
"e": 391,
"s": 172,
"text": "Timeseries forecasting is a complex art form. Many models are very sensitive to trends, cycles (called ‘seasons’) and changing magnitudes of fluctuations, and instead require stationary data, which lack these features."
},
{
"code": null,
"e":... |
Crack SQL Interviews | Towards Data Science | SQL is one of the most essential programming languages for data analysis and data processing, and so SQL questions are always part of the interview process for data science-related jobs, such as data analysts, data scientists, and data engineers. SQL interviews are meant to evaluate candidates’ technical and problem-so... | [
{
"code": null,
"e": 677,
"s": 171,
"text": "SQL is one of the most essential programming languages for data analysis and data processing, and so SQL questions are always part of the interview process for data science-related jobs, such as data analysts, data scientists, and data engineers. SQL inte... |
C# Program for Median of two sorted arrays of same size - GeeksforGeeks | 11 Dec, 2018
There are 2 sorted arrays A and B of size n each. Write an algorithm to find the median of the array obtained merging the above 2 arrays(i.e. array of length 2n). The complexity should be O(log(n)).
Note : Since size of the set for which we are looking for median is even (2n), we need take average of middl... | [
{
"code": null,
"e": 24971,
"s": 24943,
"text": "\n11 Dec, 2018"
},
{
"code": null,
"e": 25170,
"s": 24971,
"text": "There are 2 sorted arrays A and B of size n each. Write an algorithm to find the median of the array obtained merging the above 2 arrays(i.e. array of length 2n). ... |
Setting up your own Data Science workspace with Visual Studio Code and Anaconda (Python) | by Christiaan Dollen | Towards Data Science | If you’re just starting out in the field of data science, creating a personal workspace will help you keeping your projects organized. There are lots of different tools to use and if you’re just like me, starting out in the field, you might find it daunting to dive right in. In this post I’ll show you the basics of how... | [
{
"code": null,
"e": 792,
"s": 171,
"text": "If you’re just starting out in the field of data science, creating a personal workspace will help you keeping your projects organized. There are lots of different tools to use and if you’re just like me, starting out in the field, you might find it daunti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.