Maximum Path Sum with Jumps Under Divisibility Condition in C++

Ayush Gupta
Updated on 09-Sep-2020 11:57:56

123 Views

In this tutorial, we will be discussing a program to find maximum path sum for each position with jumps under divisibility conditionFor this we will be provided with an array of n random integers. Our task is to jump from one position to another if it divides it and finally provide the maximum sum path for every given position.Example Live Demo#include using namespace std; //finding maximum sum path void printMaxSum(int arr[], int n) {    int dp[n];    memset(dp, 0, sizeof dp);    for (int i = 0; i < n; i++) {       dp[i] = arr[i];   ... Read More

Maximum Parent-Children Sum in Binary Tree in C++

Ayush Gupta
Updated on 09-Sep-2020 11:55:49

248 Views

In this tutorial, we will be discussing a program to find maximum parent children sum in Binary treeFor this we will be provided with a binary tree. Our task is to add up the parent node with its children nodes and finally find the maximum of all of that and print it out.Example Live Demo#include using namespace std; struct Node {    int data;    struct Node *left, *right; }; //inserting nodes struct Node* newNode(int n) {    struct Node* root = new Node();    root->data = n;    root->left = root->right = NULL;    return root; } int maxSum(struct ... Read More

Difference Between CountdownLatch and CyclicBarrier in Java Concurrency

Himanshu shriv
Updated on 09-Sep-2020 11:55:46

1K+ Views

CountDownLatch and CyclicBarrier both used in multithreading environment and they both are part of.As per Java Doc −CountDownLatch − A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes.CyclicBarrier − A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point.Sr. No.KeyCyclicBarrierCountDownLatch1BasicA synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point.A synchronization aid that allows one or more threads to wait until a set of operations being ... Read More

Maximum of Sum and Product of Digits in C++

Ayush Gupta
Updated on 09-Sep-2020 11:52:37

263 Views

In this tutorial, we will be discussing a program to find maximum of sum and product of digits until number is reduced to a single digitFor this we will be provided with a random number. Our task is to find and print out the maximum of sum and product of the digits of the given number until it coverts to a single digitExample Live Demo#include using namespace std; //converting number to single digit by adding long repeatedSum(long n) {    if (n == 0)       return 0;    return (n % 9 == 0) ? 9 : (n % ... Read More

Maximum of Smallest Possible Area with K Cuts of Given Rectangle in C++

Ayush Gupta
Updated on 09-Sep-2020 11:49:21

144 Views

In this tutorial, we will be discussing a program to find the maximum of smallest possible area that can get with exactly k cut of given rectangular.For this we will be provided with the sides of the rectangle and the number of cuts that can be made. Our task is to calculate the smallest area that can be achieved by making the given number of cuts.Example Live Demo#include using namespace std; void max_area(int n, int m, int k) {    if (k > (n + m - 2))       cout

Difference Between Docker Swarm and Kubernetes

Himanshu shriv
Updated on 09-Sep-2020 11:49:18

581 Views

Docker Swarm and Kubernetes both can be used for similar purpose. They both are container orchestration tool.Docker Swarm is a tool used for clustering and scheduling Docker containers. We can easily establish and manage a cluster of Docker nodes under a single virtual system.Kubernetes is also container orchestration tool which is developed by google. It can be used for automatic deployment ,scaling, load balancing  and logging and monitoring.Sr. No.KeyDocker SwarmKubernetes1BasicKubernetes is also container orchestration tool which is developed by google. It can be used for automatic deployment ,scaling, load balancing  and logging and monitoring.Docker Swarm is a tool used for ... Read More

Find HCF (Highest Common Factor) of 2 Numbers in C++

Ayush Gupta
Updated on 09-Sep-2020 11:47:35

540 Views

In this tutorial, we will be discussing a program to find HCF (highest common factor) of two numbers.For this we will be provided with two numbers. Our task is to find the highest common factor (HCF) of those numbers and return it.Example Live Demo#include //recursive call to find HCF int gcd(int a, int b){    if (a == 0 || b == 0)       return 0;    if (a == b)       return a;    if (a > b)       return gcd(a-b, b);    return gcd(a, b-a); } int main(){    int a = ... Read More

Difference Between Apache Kafka and JMS

Himanshu shriv
Updated on 09-Sep-2020 11:47:03

839 Views

Kafka and JMS both are messaging system. Java message service is an api which are provided by Java. It is used for implementing messaging system in your application. JMS supports queue and publisher /subscriber(topic) messaging system . With queues, when first consumer consumes a message, message gets deleted from the queue and others cannot take it anymore. With topics, multiple consumers receive each message but it is much harder to scale.Kafka is a generalization of these two concepts - it allows scaling between members of the same consumer group, but it also allows broadcasting the same message between many different ... Read More

Find Greater Value Between A and B in C++

Ayush Gupta
Updated on 09-Sep-2020 11:46:12

169 Views

In this tutorial, we will be discussing a program to find greater value between a^n and b^n.For this we will be provided with three numbers. Our task is to calculate a^n and b^n and return back the greater of those values.Example Live Demo#include using namespace std; //finding the greater value void findGreater(int a, int b, int n){    if (!(n & 1)) {       a = abs(a);       b = abs(b);    }    if (a == b)       cout b)       cout

Difference Between Point-to-Point and Publish-Subscribe JMS Messaging Models

Himanshu shriv
Updated on 09-Sep-2020 11:44:58

844 Views

JMS is an acronym Java message service. Java message service is an api which are provided by Java. It is used for implementing messaging system in your application.JMS is an API or specification which does not contain implementation therefore to use JMS have to some third party service provider like ActiveMq , Weblogic messaging and etc.JMS support two types of messaging domain −Point to Point MessagingPublish /Subscribe messaging  Sr. No.KeyPoint to Point MessagingPublish /Subscribe1BasicIt is one to one destination of message. Message sent into the queue and that message can be read by only one receiver.It is one to many ... Read More

Advertisements