Skip to content

Instantly share code, notes, and snippets.

View roychowdhuryrohit-dev's full-sized avatar
💻
Building

Rohit Roy Chowdhury roychowdhuryrohit-dev

💻
Building
View GitHub Profile

Keybase proof

I hereby claim:

  • I am roychowdhuryrohit-dev on github.
  • I am rychwdhryrohit (https://keybase.io/rychwdhryrohit) on keybase.
  • I have a public key ASCf_H7-lVL1ZavligGxiaxtExSPstjw9QRetZS9r8_WDQo

To claim this, I am signing this object:

@roychowdhuryrohit-dev
roychowdhuryrohit-dev / recurrence.py
Created November 14, 2020 11:31
Find all values in a list that are present in the following sequence : f(0) = 0, f(1) = 1, f(n) = 5*f(n-1) - 2*f(n-2) for all n > 1
from math import ceil, log, sqrt
"""
This solution uses the closed form expression of the given linear recurrence relation. Some approximations has been made to calculate the nearest value of n. Unlike other solutions that use recursion or memoization techniques, this is a much more faster and efficient constant time O(1) solution (assuming real-valued arithmetic is constant time).
"""
phi = 4.561552813
psi = 0.4384471872
sq = sqrt(17)
def isPresent(k):
from hashlib import sha256
import time
from json import dumps
# to define each blocks
class Block:
def __init__(self, data, prevHash=None):
self.data = data
#include <stdio.h>
void sort(int pid[], int at[], int bt[], int n) {
int temp, i, j, flag;
for(i = 1;i<n;i++) {
flag = 1;
for(j = 0;j<(n-i);j++) {
if(at[j]>at[j + 1]) {
temp = pid[j];
pid[j] = pid[j + 1];
pid[j + 1] = temp;
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int startTime, endTime, weight;
} Job;
struct S {
// current job, last job.
int cJob, lJob, weight;
} *jobSeq;
// Comparator function to be passed to qsort.
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define X 99
// To reset the board and remove queens.
void reset(int *board, int dim) {
int i;
for(i = 0;i<dim;i++) {
board[i] = X;
}
@roychowdhuryrohit-dev
roychowdhuryrohit-dev / BankManagementSystem.java
Last active April 18, 2023 15:32
Bank Management System as Java Console App
import java.util.*;
import java.text.*;
interface SavingsAccount
{
final double rate = 0.04,limit = 10000,limit1 = 200;
void deposit(double n,Date d);
void withdraw(double n,Date d);
}
class Customer implements SavingsAccount
{
/*
* ----ROHIT ROY CHOWDHURY(Zeu5)----
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct S
{
int data;
struct S *l,*r;
} node;