Skip to content

Instantly share code, notes, and snippets.

View abenezerangelos's full-sized avatar

abenezerangelos

  • Washington State University
View GitHub Profile
@abenezerangelos
abenezerangelos / doomsday_fuel.py
Created August 9, 2023 09:21 — forked from algomaster99/doomsday_fuel.py
Solution to Doomsday Fuel foobar challenge
from fractions import Fraction
# Replace trials by probabilties of occurrences
def replace_probability(m):
for row in range(len(m)):
total = 0
for item in range(len(m[row])):
total += m[row][item]
if total != 0:
for item in range(len(m[row])):
from fractions import *
from decimal import *
from collections import *
import time
input=[[4, 17, 50],
[4, 30, 50],
[4,36,67],
[4,36,67,69],
[4,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,54],
[0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],
import time
from fractions import *
from decimal import *
from collections import *
input=[[4, 17, 50],
[4, 30, 50],
[4,36,67],
[4,36,67,69],
[4,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,54],
[0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],
import time
from fractions import *
from decimal import *
from collections import *
input=[[4, 17, 50],
[4, 30, 50],
[4,36,67],
[4,36,67,69],
[4,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,54],
[0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],
@abenezerangelos
abenezerangelos / BST.py
Created May 19, 2023 19:41
This is the cleanest and most efficient code I have written for this implementation-(maybe not the most space efficient
import math
class BST:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert(self, value):
@abenezerangelos
abenezerangelos / avltree.py
Created April 29, 2023 21:24
avltree implementation
import math
class BSTNode:
'''
'''
def __init__(self, data, left=None, right=None, parent=None):
'''
@abenezerangelos
abenezerangelos / algoexperteasy implementation
Created April 24, 2023 09:04
sort mechanism and algoexpert easy question attempted
package com.company;
import java.util.*;
public class Main {
public static void main(String[] args) {
// write your code here
int [] arr= {10,5,2,3,5,4,3,7,8,9,1,0};
int [] arrayer={5, 1, 22, 25, 6, -1, 8, 10};
@abenezerangelos
abenezerangelos / leetcode
Created December 20, 2022 09:06
Easy leetcode problems solutions
nums = [1,2,3,4]
#Output: [1,3,6,10]
def runningSum(self, nums) :
array = [0]
for i in nums:
array.append(i + array[-1])
print(array)
array.remove(0)
@abenezerangelos
abenezerangelos / flash-card.py
Created July 31, 2022 10:48
productivity tool for studying languages and vocabularies
from tkinter import *
import pandas as pd
import csv
from random import *
from tkinter.messagebox import *
CARD_BACK_BACKGROUND_COLOR="#96C1AA"
BACKGROUND_COLOR = "#B1DDC6"
learning_language="French"
language_already_learned="English"
try:
@abenezerangelos
abenezerangelos / password-manager.py
Created July 25, 2022 01:56
productivity-tool to manage password
import random
from random import *
from tkinter import *
from tkinter.messagebox import *
from string import *
from json import *
import pyperclip
from tkinter.simpledialog import *