Skip to content

Instantly share code, notes, and snippets.

View rashedcs's full-sized avatar

Rashedul Islam rashedcs

  • Bangladesh
View GitHub Profile
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
char s[50000];
long i,l,p=0;
while(gets(s))
{
#include<iostream>
#include<stdlib.h>
using namespace std;
int front=0,rear=0;
void insertion(int queue[])
{
int num;
cout<<"\nEnter the item to be inserted : ";
@rashedcs
rashedcs / BST.cpp
Last active November 2, 2021 04:05
Binary Search Tree
#include<bits/stdc++.h>
using namespace std;
struct bst
{
int data;
bst *left;
bst *right;
}*root=NULL;
#include<bits/stdc++.h>
#define pii pair<int,int>
#define infinity 99999999999
using namespace std;
long long int n,m,u,v,w;
int fibo(int n)
{
if(n<=2) return 1;
else return fibo(n-2) + fibo(n-1);
}
int memo[100];
int fibo(int n)
{
if(n<=2) return 1;
else if(memo[n]!=-1) return memo[n];
else return memo[n] = fibo(n-1) + fibo(n-2);
}
int N, V[100], W[100], memo[100][100];
int value(int id, int w)
{
if (memo[id][w] != -1) return memo[id][w]; //Memoization
if (id == N || w == 0) return 0; //Base Case
else if (W[id] >w) return memo[id][w] = value(id + 1, w);
else return memo[id][w] = max(value(id + 1, w), V[id] + value(id + 1, w - W[id]));
}
Algorithm MergeSort(arr, l, h)
{
if(low < high) then
{
mid := (low + high) / 2;
MergeSort(arr, low, mid);
MergeSort(arr, mid+1, high);
Merge(arr, low, mid, high);
}
}
@rashedcs
rashedcs / pagination.php
Created November 5, 2017 14:46 — forked from vineeth030/pagination.php
Pagination with PHP & MYSQL
<?php
$num_rec_per_page=10;
mysql_connect('localhost','root','');
mysql_select_db('apex1');
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = "SELECT * FROM student LIMIT $start_from, $num_rec_per_page";
$rs_result = mysql_query ($sql); //run the query
?>
<table>