Skip to content

Instantly share code, notes, and snippets.

View J16N's full-sized avatar
🎨
Being Creative

Tsubasa J16N

🎨
Being Creative
View GitHub Profile
@J16N
J16N / multiplicative_inverse.py
Created June 1, 2024 08:45
Finding multiplicative inverse using extended euclidean algorithm.
def multiplicative_inverse(a: int, b: int, t1: int = 0, t2: int = 1):
if b > a:
return multiplicative_inverse(b, a, t1, t2)
if b == 0:
return t1
q = a // b
r = a % b
t = t1 - t2 * q
return multiplicative_inverse(b, r, t2, t)
@J16N
J16N / doublyLinkedCircularLL.c
Created January 12, 2022 16:53
This is my implementation of Doubly Linked Circular Linked List
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct node {
int data;
struct node *next;
struct node *prev;
} NODE;
@J16N
J16N / linkedList.c
Last active December 14, 2021 14:14
Every possible linked list operations except sorting.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct node {
int data;
struct node *next;
} NODE;
typedef struct lList {
@J16N
J16N / queue.c
Created November 13, 2021 04:53
Queue using dynamic array
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int *container;
int front, rear, size;
} Queue;
int len(Queue *);
@J16N
J16N / encrypt.c
Created July 27, 2021 13:31
Encrypt your sensitive files.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Required Prototypes
char *get_file(char *);
int encrypt(char *);
char *renamef(char *, char *);
int main(int argc, char *argv[])
@J16N
J16N / matrix.c
Created July 24, 2021 14:07
Get user defined 2D matrix without predefining rows and columns.
// Required headers
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// prototypes
int **get_matrix(char *, int *, int *);
void free_matrix(int **, int);
int main(int argc, char *argv[])