Posts

Showing posts from April, 2020

CSV to SQL import

Image
CSV to SQL import Link :   https://tinyurl.com/csv-sql-import Github :  https://github.com/krishankantray/csv-to-sql-import-client           https://github.com/krishankantray/csv-to-sql-import-server What is this app all about ? This app allows users to import a .csv file and save it in MySQL. The .csv file needs to be in a specified format, something like   this  . Once the data is saved we can see and delete the table data on the front-end. Whats there on back-end and front-end ? Back-End : NodeJS ExpressJS MySQL Front-End : ReactJS Here is the table structure : Field           Type --------------------------- id         int(11) level_col varchar(255) cvss         varchar(255) title         varchar(255) vulnerability varchar(255) solution varchar(255) reference_col varchar(255) Where is it deployed ? Client side app ( React app ) is deployed on  Netlify Server side app ( Node app ) is deployed on  Heroku MySQL datab

Kadane's Algorithm

Kadane's Algorithm TL;DR This algorithm is used to find maximum sum sub-array from a given array.  Its has O(n) time complexity and O(1) space complexity.   It works irrespective of whether the elements are positive or negative, whether sorted or unsorted.  Its DP approach Its brute force approach takes O(n^2) as it calculates all possible sub-array and then return maximum out of them.  Since brute force approach is very obvious and easy to implement, so, I am not discussing it here. Lets directly jump to Kadane's Algorithm :  Its uses two variables one stores local maximum ( local_maximum ) and other stores global maximum ( global_maximum ) . Initialise , local_maximum = 0 and global_maximum = -Infinity  We start iteration from the first element, and for each element we check following condition before updating the local_maximum : if  local_maximum < 0 ,  then local_maximum = arr[i] ,  this is because if local_maximum is negative value the