Programming Articles - Page 1723 of 3366

Maximum possible intersection by moving centers of line segments in C++

Ayush Gupta
Updated on 09-Sep-2020 12:21:51

131 Views

In this tutorial, we will be discussing a program to find maximum possible intersection by moving centers of line segmentsFor this we will be provided with the center of three line segments and their length. Our task is to move their center by K distance to increase the length of intersection region.Example Live Demo#include using namespace std; //finding maximum intersection int max_intersection(int* center, int length, int k) {    sort(center, center + 3);    if (center[2] - center[0] >= 2 * k + length) {       return 0;    }    else if (center[2] - center[0] >= 2 ... Read More

Count unique sublists within list in Python

Pradeep Elance
Updated on 09-Sep-2020 12:21:49

572 Views

A Python list can also contain sublist. A sublist itself is a list nested within a bigger list. In this article we will see how to count the number of unique sublists within a given list.Using CounterCounter is a subclass of Dictionary and used to keep track of elements and their count. It is also considered as an unordered collection where elements are stored as Dict keys and their count as dict value. So in the below example we directly take a list which has sublists.Example Live Demofrom collections import Counter # Given List Alist = [['Mon'], ['Tue', 'Wed'], ['Tue', 'Wed']] ... Read More

Maximum possible difference of two subsets of an array in C++

Ayush Gupta
Updated on 09-Sep-2020 12:20:29

581 Views

In this tutorial, we will be discussing a program to find maximum possible difference of two subsets of an arrayFor this we will be provided with an array containing one or two instances of few random integers. Our task is to create two subsets of that array such that the difference of their sum is maximum and no subset contains repetitive numbers.Example Live Demo#include using namespace std; //finding maximum subset difference int maxDiff(int arr[], int n) {    int SubsetSum_1 = 0, SubsetSum_2 = 0;    for (int i = 0; i

Maximum points of intersection n lines in C++

Ayush Gupta
Updated on 09-Sep-2020 12:18:22

204 Views

In this tutorial, we will be discussing a program to find maximum points of intersection n linesFor this we will be provided with a number of straight lines. Our task is to find the maximum number of intersections the given number of lines meet.Example Live Demo#include using namespace std; #define ll long int //finding maximum intersection points ll countMaxIntersect(ll n) {    return (n) * (n - 1) / 2; } int main() {    ll n = 8;    cout

Maximum points of intersection n circles in C++

Ayush Gupta
Updated on 09-Sep-2020 12:16:37

173 Views

In this tutorial, we will be discussing a program to find maximum points of intersection n circlesFor this we will be provided with the number of circles. Our task is to find the maximum number of intersections the given number of circles meet.Example Live Demo#include using namespace std; //returning maximum intersections int intersection(int n) {    return n * (n - 1); } int main() {    cout

Assign ids to each unique value in a Python list

Pradeep Elance
Updated on 09-Sep-2020 12:14:43

981 Views

While using Python dictionary we may need to identify each element of the dictionary uniquely. For that we have to assign unique IDs to each of the element in the dictionary. In this article we will see how to assign the same unique Id to an element if it is repeated in a Python dictionary.With enumerate() and OrderedDict.fromkeys()The enumerate function expands a given dictionary by adding a counter to each element of the dictionary. Then we apply the OrderedDict.fromkeys() which will extract the same value of the counter from the dictionary hence eliminating the duplicates values of IDs.Example Live Demofrom collections ... Read More

Maximum points from top left of matrix to bottom right and return back in C++

Ayush Gupta
Updated on 09-Sep-2020 12:14:30

377 Views

In this tutorial, we will be discussing a program to find maximum points from top left of matrix to bottom right and return backFor this we will be provided with matrix consisting of #-blocked path, *-points, .- allowed path. Our task is to go from one corner to another (right and below moves) and come back (left and top moves) such as to collect maximum pointsExample Live Demo#include #define MAX 5 #define N 5 #define M 5 #define inf 100000 using namespace std; //calculating points int cost(char grid[][M], int row1, int col1, int row2, int col2) {    if (row1 ... Read More

Difference between Oracle 11g and Oracle 12c

Himanshu shriv
Updated on 09-Sep-2020 12:10:22

7K+ Views

Oracle 12c is just upgraded version of the Oracle 11g with some new features like cloud support and pluggable database, kind of like master slave architecture. With the Oracle 12 c, you can plug your database to cloud anytime. It has multiple new features like JSON support, multitenant architecture and etc.Sr. No.KeyOracle 11gOracle 12c1BasicIt was released in released in 2008 and has no pluggable databaseIt is High performance RDbMS which is released in 2014. It is pluggable database.2Identity columnWe can't set primary key to raise automaticallyWe can set primary key to rise automatically.3JSON typeWe can't store Json directly to the ... Read More

Maximum points covered after removing an Interval in C++

Ayush Gupta
Updated on 09-Sep-2020 12:08:40

234 Views

In this tutorial, we will be discussing a program to find maximum points covered after removing an IntervalFor this we will be provided with N intervals and the maximum range value . Our task is to find that one interval which when removed will give us the maxim numbers in the given range from 1 to maximum range valueExample Live Demo#include #define ll long long int using namespace std; //finding required interval void solve(int interval[][2], int N, int Q) {    int Mark[Q] = { 0 };    for (int i = 0; i < N; i++) {     ... Read More

Difference between Hibernate and Eclipse link

Himanshu shriv
Updated on 09-Sep-2020 12:06:39

2K+ Views

Hibernate and Eclipse link both are object relational mapping tool. They both are the implementation of JPA.Hibernate is very popular implementation of JPA built by Red hat. It also has some extra features that JPA does not provide.Eclipse is an open source implementation of JPA built by Eclipse foundation. It 'is one of the first project which became part of EE4J. It is available in two forms −Eclipse link jar file format − It is complete package. It has everything which need to run any Eclipse link functionality.OSGI bundles for each of the eclipse link component.Sr. No.KeyHibernateEclipse link1BasicIt is a ... Read More

Advertisements