K

@kowshic

DCDM

Python
2 years ago
from faker import Faker import random fake = Faker() def generate_patient_data(num_patients): patient_data = [] for _ in range(num_patients): patient_name = fake.name() age = random.randint(18, 80)

DFS

Python
2 years ago
class Graph: def __init__(self): self.graph = {} def add_edge(self, u, v): if u not in self.graph: self.graph[u] = [] self.graph[u].append(v) def dfs(self, start):

BFS

Python
2 years ago
class Graph: def __init__(self): self.graph = {} def add_edge(self, u, v): if u not in self.graph: self.graph[u] = [] self.graph[u].append(v) def bfs(self, start):

FLOYD WARSHAL

Python
2 years ago
nV = 4 INF = 999 # Algorithm implementation def floyd_warshall(G): distance = list(map(lambda i: list(map(lambda j: j, i)), G)) # Adding vertices individually

round robin

Python
2 years ago
# Python3 program for implementation of # RR scheduling # Function to find the waiting time # for all processes def findWaitingTime(processes, n, bt, wt, quantum): rem_bt = [0] * n # Copy the burst time into rt[]

fcfs

Python
2 years ago
# Python3 program for implementation # of FCFS scheduling # Function to find the waiting # time for all processes def findWaitingTime(processes, n, bt, wt): # waiting time for # first process is 0

priority

Python
2 years ago
# Python3 program for implementation of # Priority Scheduling # Function to find the waiting time # for all processes def findWaitingTime(processes, n, wt): wt[0] = 0

sjf

Python
2 years ago
# converting the code to python3 def main(): # Taking the number of processes n = int(input("Enter number of process: ")) # Matrix for storing Process Id, Burst Time, Average Waiting Time & Average Turn Around Time. A = [[0 for j in range(4)] for i in range(100)] total, avg_wt, avg_tat = 0, 0, 0 print("Enter Burst Time:")