Articles on Trending Technologies

Technical articles with clear explanations and examples

How to write the comparator as a lambda expression in Java?

raja
raja
Updated on 06-Dec-2019 5K+ Views

A lambda expression is an anonymous method and doesn't execute on its own in java. Instead, it is used to implement a method defined by the functional interface. A lambda expression used with any functional interface and Comparator is a functional interface. The Comparator interface has used when sorting a collection of objects compared with each other.In the below example, we can sort the employee list by name using the Comparator interface.Exampleimport java.util.ArrayList; import java.util.Collections; import java.util.List; class Employee { int id; String name; double salary; public ...

Read More

Generating any custom JSON in ABAP

Manikanth Mani
Manikanth Mani
Updated on 05-Dec-2019 2K+ Views

You can use class ZCL_MDP_JSON Library that can encode/parse any JSON. JSON is supported natively in ABAP by the following features:With the use of JSON-XML- it is known as special XML format that can be used for JSON data to be described using an XML representation. By defining a mapping between ABAP types and JSON. This is used in serializations and deserializations using the identity transformation ID.As you can specify JSON data in different forms as an XML source in the statement CALL TRANSFORMATION and JSON can be specified as a target.Check out the following sample code:Example:DATA text TYPE string VALUE ...

Read More

Cracking Campus Interviews: Tips and Tricks that Boost Your Confidence

Swetha Prasanna
Swetha Prasanna
Updated on 04-Dec-2019 264 Views

Campus interviews play an important role in acquiring a good job after studying hard throughout the course duration. It so happens that some students get multiple placements while others struggle to even get through one placement successfully. Though the main aspect that companies look into is the graduation scores, there are many criteria that the interviewers notice in a candidate.Here is a guide of tips and tricks that will help any student to attend and crack the campus interview with confidence.Research about the companyWhen appearing for the interview in a company, it is expected that you know the basic details ...

Read More

How to extract subset of key-value pairs from Python dictionary object?

Jayashree
Jayashree
Updated on 04-Dec-2019 3K+ Views

Use dictionary comprehension technique.We have dictionary object having name and percentage of students>>> marks = {    'Ravi': 45.23,    'Amar': 62.78,    'Ishan': 20.55,    'Hema': 67.20,    'Balu': 90.75 }To obtain dictionary of name and marks of students with percentage>50>>> passed = { key:value for key, value in marks.items() if value > 50 } >>> passed {'Amar': 62.78, 'Hema': 67.2, 'Balu': 90.75}To obtain subset of given names>>> names = { 'Amar', 'Hema', 'Balu' } >>> lst = { key:value for key,value in marks.items() if key in names} >>> lst {'Amar': 62.78, 'Hema': 67.2, 'Balu': 90.75}

Read More

C++ Program to implement t-test

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 1K+ Views

In this tutorial, we will be discussing a program to implement t-test.The t-test of the student’s T test is used to compare two means and tell if both of them are similar or different. Along with this, t-test also helps to determine how large the differences are to know the reason for the change.Example#include using namespace std; //calculating mean float calc_mean(float arr[], int n){    float sum = 0;    for (int i = 0; i < n; i++)       sum = sum + arr[i];    return sum / n; } //calculating standard deviation float calc_deviation(float arr[], ...

Read More

C++ Program to implement standard error of mean

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 325 Views

In this tutorial, we will be discussing a program to implement standard error of mean.Standard error of mean is the estimation of sample mean dispersion from population mean. Then it is used to estimate the approximate confidence intervals for the mean.Example#include using namespace std; //calculating sample mean float calc_mean(float arr[], int n){    float sum = 0;    for (int i = 0; i < n; i++)       sum = sum + arr[i];    return sum / n; } //calculating standard deviation float calc_deviation(float arr[], int n){    float sum = 0;    for (int i = ...

Read More

C++ program to implement Simpson's 3/8 rule

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 1K+ Views

In this tutorial, we will be discussing a program to implement SImpson’s ⅜ rule.Simpson’s ⅜ rule is used for doing numerical integrations. The most common use case of this method is in performing numerical approximations of definite integrals.In this, the parabolas on the graph are used for performing the approximations.Example#include using namespace std; //function that is to be integrated float func_inte( float x){    return (1 / ( 1 + x * x )); } //calculating the approximations float func_calculate(float lower_limit, float upper_limit, int interval_limit ){    float value;    float interval_size = (upper_limit - lower_limit) / interval_limit;    float ...

Read More

C++ Program to implement Linear Extrapolation

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 1K+ Views

In this tutorial, we will be discussing a program to implement Linear Extrapolation.Extrapolation is defined as a process in which the required value for a certain function is beyond the lower or the upper limits of the function definition.In the case of Linear Extrapolation, the value beyond the scope is found using the tangent made on the graph of the function to determine the required value. Linear Extrapolation gives quite accurate results when applied.Example#include using namespace std; //structuring the values of x and y struct Data {    double x, y; }; //calculating the linear extrapolation double calc_extrapolate(Data d[], ...

Read More

C++ program to implement Inverse Interpolation using Lagrange Formula

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 508 Views

In this tutorial, we will be discussing a program to implement Inverse Interpolation using Lagrange formula.Inverse Interpolation is defined as the method of finding the value of an independent variable from the given value of dependent value lying between two tabulated set of values for an unknown function.Example#include using namespace std; //structuring the values of x and y struct Data {    double x, y; }; //calculating inverse interpolation double calc_invinter(Data d[], int n, double y){    double x = 0;    int i, j;    for (i = 0; i < n; i++) {       double ...

Read More

C++ program to implement Collatz Conjecture

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2019 520 Views

In this tutorial, we will be discussing a program to implement Collatz Conjecture.For this, we will be given with a number n and we have to find out whether it can be converted to 1 using two operations −If n is even, n is converted to n/2.If n is odd, n is converted to 3*n + 1.Example#include using namespace std; //checking if n reaches to 1 or not bool check1(int n, unordered_set &s){    if (n == 1)       return true;    if (s.find(n) != s.end())       return false;    return (n % 2)? check1(3*n + ...

Read More
Showing 56301–56310 of 61,297 articles
Advertisements