Skip to content

Instantly share code, notes, and snippets.

View echo-akash's full-sized avatar
🎯
If you don't fight for what you want, Don't cry for what you lost.

akash poddar echo-akash

🎯
If you don't fight for what you want, Don't cry for what you lost.
View GitHub Profile
#problem-1
#process breakdown
#divide the number by 1 - so we get the number of steps required in total if only 1 step is followed
#scenario for 1 step
n = 3
s1 = int(n/1)
# print(s1)
-- Add new column in database which is foreign key
ALTER TABLE database.table
ADD COLUMN columnname INT DEFAULT(1),
ADD FOREIGN KEY fk_name(fk_column) REFERENCES reftable(refcolumn) ON DELETE CASCADE;
--create table
CREATE TABLE IF NOT EXISTS checklists (
todo_id INT AUTO_INCREMENT,
task_id INT,
todo VARCHAR(255) NOT NULL,
--Tutorial Link - https://www.mysqltutorial.org/mysql-stored-procedure-tutorial.aspx/
--
--CREATE PROCEDURE
--
DELIMITER //
CREATE PROCEDURE procedure_name(parameter_list)
BEGIN
@echo-akash
echo-akash / Knapsack_0-1.java
Created October 5, 2017 16:10
Finding maximum profit in 0-1 Knapsack in Java
package javalab02;
import java.util.Scanner;
public class JavaLab02 {
public static int findProfit(int i, int c, int w[], int v[], int n){
if(i==n||c==0){
return 0;
}else if(w[i]<=c){
int x1 = v[i] + findProfit(i+1,c-w[i], w, v, n);
@echo-akash
echo-akash / lcs.java
Created October 5, 2017 16:08
Finding Longest Common Subsequence (LCS) using Dynamic Programming in Java
package javalab;
import java.util.Scanner;
public class JavaLab {
char X[];
char Y[];
int l1,l2;
int c[][];
int b[][];
@echo-akash
echo-akash / Max_Min_DC.java
Created October 5, 2017 16:02
Finding maximum and minimum elements in an Integer array using Divide and Conquer method in Java
import java.util.Scanner;
public class MaxMinDC {
static Scanner sc = new Scanner(System.in);
static int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
static int a[];
static int size;
@echo-akash
echo-akash / MergeSort.java
Created October 5, 2017 15:58
Merge Sort of Array of integers in Java
import java.util.Scanner;
public class MergeSort {
static Scanner sc = new Scanner(System.in);
static int size;
static int a[];
static int b[];
@echo-akash
echo-akash / QuickSort.java
Created October 5, 2017 15:56
Quick Sort Using Java
import java.util.Scanner;
public class QuickSort
{
static Scanner sc = new Scanner(System.in);
static int size;
public static int arr[];
public static void sort(int arr[], int low, int high)
{
@echo-akash
echo-akash / triangle_validity.c
Created August 10, 2017 17:27
Input three angles of triangle and check whether it's valid triangle or not.
#include<stdio.h>
int main()
{
float x,y,z;
printf("enter the three angles:");
scanf("%f%f%f",&x,&y,&z);
if(x+y+z<=180)
printf("triangle is valid");
else
printf("triangle is not valid");
@echo-akash
echo-akash / unit_tenth_print.c
Created August 10, 2017 17:25
Print the unit and tenth place value of a number.
#include<stdio.h>
int main()
{
int n;
printf("enter the number:");
scanf("%d",&n);
printf("unit place:%d",n%10);
printf("\nten's place:%d",(n/10)%10);
return 0;
}