Skip to content

Instantly share code, notes, and snippets.

View Furkan-Gulsen's full-sized avatar

Furkan Gulsen Furkan-Gulsen

View GitHub Profile
@Furkan-Gulsen
Furkan-Gulsen / main.py
Created January 11, 2024 22:13
Get Task Index at Cycle
def get_task_index_at_cycle(jobs, cycle):
execution_order = sorted(range(len(jobs)), key=lambda k: (jobs[k], k))
total_time = sum(jobs)
cycle = cycle % total_time + 1 if cycle >= total_time else cycle
current_time = 0
for job_index in execution_order:
current_time += jobs[job_index]
if cycle <= current_time:
return job_index
@Furkan-Gulsen
Furkan-Gulsen / main.py
Created January 11, 2024 22:12
Get Task Index at Cycle (dependencies)
def get_task_index_at_cycle(jobs, dependencies, cycle):
"""Finds the index of the task running at the given cycle, considering dependencies.
Args:
jobs: A list of task durations.
dependencies: A list of task dependencies, where -1 indicates no dependency.
cycle: The cycle time to check.
Returns:
The index of the task running at the given cycle, or -1 if no task is running.
@Furkan-Gulsen
Furkan-Gulsen / index.js
Created May 23, 2022 00:08
Patika GraphQL - Odev - 2
const { ApolloServer, gql } = require("apollo-server");
const { events, locations, participants, users } = require("./data");
const { nanoid } = require("nanoid");
const {
ApolloServerPluginLandingPageGraphQLPlayground,
} = require("apollo-server-core");
const typeDefs = gql`
type event {
id: ID!
@Furkan-Gulsen
Furkan-Gulsen / main.java
Created May 21, 2022 07:39
Patika Java 102 - Ödev - Fikstür Oluşturucu
import java.util.ArrayList;
import java.util.List;
import java.util.LinkedHashMap;
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
@Furkan-Gulsen
Furkan-Gulsen / main.java
Created May 21, 2022 07:26
Patika Java 102 - Ödev - Kitap Sıralayıcı
import java.util.Comparator;
import java.util.TreeSet;
class Book implements Comparable<Book>{
private final String name;
private final int pageNumber;
private final String author;
private final int publishDate;
@Furkan-Gulsen
Furkan-Gulsen / index.js
Last active May 20, 2022 22:06
graphql-patika-odev-1
const { ApolloServer, gql } = require("apollo-server");
const { events, locations, participants, users } = require("./data");
const typeDefs = gql`
type event {
id: ID!
title: String!
desc: String!
date: String!
from: String!
package Giris;
import java.lang.Math;
public class Main {
public static void main(String[] args) {
Fighter marc = new Fighter("Marc" , 15 , 100, 90, 0);
Fighter alex = new Fighter("Alex" , 10 , 95, 100, 0);
package Giris;
import java.util.Scanner;
public class Baslangic {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int a, total = 0;
do{
System.out.print("Enter a number: ");
a = input.nextInt();
package Giris;
import java.util.Scanner;
public class Baslangic {
public static void main(String args[]) {
Scanner scanner=new Scanner(System.in);
int sayi1=scanner.nextInt();
for (int i=0;i<=sayi1;i++)
{
package Giris;
import java.util.Scanner;
public class Baslangic {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Yılı Giriniz: " );
int yil=scanner.nextInt();
if(yil%4==0) {