Ritesh Dewoolkar

Matrix Chain Multiplication – Python Solution

Given a sequence of matrices, find the most efficient way to multiply these matrices together. The efficient way is the one that involves the least number of multiplications.
The dimensions of the matrices are given in an array arr[] of size N (such that N = number of matrices + 1) where the ith matrix has the dimensions (arr[i-1] x arr[i]).
Input: N = 5
arr = {40, 20, 30, 10, 30}
Output: 26000
Explaination: There are 4 matrices of dimension 
40x20, 20x30, 30x10, 10x30. Say the matrices are 
named as A, B, C, D. Out of all possible combinations,
the most efficient way is (A*(B*C))*D. 
The number of operations are -
20*30*10 + 40*20*10 + 40*10*30 = 26000.
Python Solution:
class Solution:
   def matrixMultiplication(self, N, arr):
   # code here
     dp = [[0 for x in range(N)] for y in range(N)]
     temp_cost = 0
     for diff in range(1,N-1):
       for i in range(1,N-diff):
          j = i + diff
          min_cost = float('inf')
          for k in range(i,j):
             temp_cost = dp[i][k] + dp[k+1][j] + arr[i-1]arr[k]arr[j]
             if(temp_cost < min_cost):
                min_cost = temp_cost
          dp[i][j] = min_cost
     return dp[1][N-1]

Different types of security breaches?

What is a Security Breach?

A security breach occurs when an unauthorized person gets access to your computer data, applications, networks, or devices. A security breach can lead to things like system damage and data loss and can also damage an organization’s reputation or finances.
A security and data breach is the worst thing that can happen to any organization or its customers. A security breach can also make an organization face reputational loss.

What are the types of Security Breaches?

How to create a contact form in HTML & CSS

 In this article, we will see the code for the contact form in HTML & CSS and also use Bootstrap for making it responsive for both Web applications and Mobile applications.

What is a contact form?

  A contact form is basically a page or a medium for users on the website to contact the site’s owner or the organization in case of a query or for inquiry purposes. 

Contact Form HTML Code:

DoS Attack

Denial of Service Attacks(DoS) and its types?

What is a Denial of Service attack?

A Denial of Service is a cyber-attack in which the attacker with malicious aim makes the machine or network resource unavailable to its intended users by flooding the target network with heavy traffic.
The DoS attacks typically exploited the security vulnerabilities present in the network or system. The victims of DoS attacks are often high-profile organizations such as banking, commerce, government, and trade organizations.

What are the 7 layers of the OSI model?

OSI stands for Open Systems Interconnection and is been developed by ISO(International Organization of Standardization) in the year 1984. The OSI reference model is a 7 layer architecture with each layer having its own specific function to perform.
The OSI model is a conceptual framework to better understand the complex interactions that are happening. The layers of the OSI model work collaboratively to transmit data from one person to another across the globe.
The first 4 layers are considered as the lower layers or hardware layers and are responsible for moving data around. The layers from 5-7 are called the upper layers of software layers and contain application-level data.

The 7 layers of the OSI model are:

Types of Intrusion Detection System(IDS)

What is Intrusion Detection System(IDS)?

An Intrusion Detection System(IDS) is a software application that scans a network or a system for malicious activities or policy violations.
Any malicious activity or violation is reported either to the network administrator or collected using a SIEM system(security information and event management).
A SIEM system combines output from multiple sources and uses alarm filtering techniques to differentiate between malicious activities from false alarms.