Skip to content

Instantly share code, notes, and snippets.

View projjal1's full-sized avatar
💭
Software Developer

Projjal Gop projjal1

💭
Software Developer
View GitHub Profile
@projjal1
projjal1 / which-character-are-you.ipynb
Created November 16, 2020 04:48
Which Character are you?.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@projjal1
projjal1 / wine-class-prediction.ipynb
Created November 16, 2020 04:46
Wine Class Prediction.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@projjal1
projjal1 / fcfs.c
Created October 20, 2020 13:19
FCFS Scheduling in C
#include<stdio.h>
void fcfs(int arr[],int n,int cur_block)
{
//First print the current block
printf("%d ",cur_block);
for(int i=0;i<n;i++)
{
cur_block=arr[i];
@projjal1
projjal1 / script.py
Created October 14, 2020 05:28
CodeVita 2016 Round 2 Question: The Mystery of Sky
#Question available at https://www.programminggeek.in/2016/08/codevita-2016-round-2-question-mystery.html#.X4Z9AObitPY
#Question available at https://www.programminggeek.in/2016/08/codevita-2016-round-2-question-mystery.html#.X4Z9AObitPY
import datetime
days_in_week={'Sunday':0,'Monday':1,'Tuesday':2,'Wednesday':3,'Thursday':4,'Friday':5,'Saturday':6}
t=int(input())
def calc_stars(diff,year,day,dobj):
@projjal1
projjal1 / srtf.c
Created May 13, 2020 16:29
SRTF scheduling algorithm in C.
#include<stdio.h>
void main()
{
int a[10],b[10],x[10];
int waiting[10],turnaround[10],completion[10];
int i,j,smallest,count=0,time,n;
double avg=0,tt=0,end;
@projjal1
projjal1 / sjf.c
Created May 13, 2020 16:28
SJF scheduling algorithm in C
#include<stdio.h>
//Sorting in increasing order of arrival time
void arrangeArrival(int num, int mat[][6])
{
for(int i=0; i<num; i++)
{
for(int j=0; j<num-i-1; j++)
{
if(mat[j][1] > mat[j+1][1])
{
@projjal1
projjal1 / fcfs.c
Created May 13, 2020 16:27
FCFS implmentation in C.
#include <stdio.h>
// Function to find the waiting time for all
// processes
void findWaitingTime (int processes [], int n, int bt [], int wt [])
{
// waiting time for first process is 0
wt [0] = 0;
// calculating waiting time
@projjal1
projjal1 / dining_philosopher.py
Created May 13, 2020 16:26
Write a program to implement Dining Philosopher problem using monitor.
#!/usr/bin/env python3
from threading import Thread, Condition, RLock
import time
# state
HUNGRY = 0
EATING = 1
THINKING = 2
#Monitor class
@projjal1
projjal1 / producer_consumer.c
Created May 13, 2020 16:25
Write a program to implement Producer- Consumer problem using semaphores.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
pthread_t *producers;
pthread_t *consumers;
@projjal1
projjal1 / worst_fit.c
Created May 13, 2020 13:45
Worst Fit Memory Management Scheme in C
#include <stdio.h>
void worstFit(int blockSize[],int m,int processSize[],int n)
{
//Block allocations for process
int allocation[n];
//Initially allocate the index of -1 to all allocation blocks
for (int i=0;i<n;i++)
{