Skip to content

Instantly share code, notes, and snippets.

View wildonion's full-sized avatar
💭
future.await;

dewo wildonion

💭
future.await;
View GitHub Profile
@wildonion
wildonion / ucg.py
Created October 28, 2020 12:17
undirected cyclic graph
# UDCG : undirected cyclic graph
class Graph:
def __init__(self):
self.vertices = {}
def add_vertex(self, key):
vertex = Vertex(key)
self.vertices[key] = vertex
@wildonion
wildonion / bst.py
Last active October 28, 2020 12:24
binary search tree example
# =====================================
import random
# BST problem
NODES = []
class Node:
@wildonion
wildonion / dfs.py
Created October 28, 2020 12:19
dfs binary tree
# DFS binary tree
# ---------------
# DFS BINARY TREE
# ---------------
def dfs(tree, value):
if tree.root is None:
@wildonion
wildonion / idds.py
Created October 28, 2020 12:20
idds binary tree
# IDDS binary tree
# ----------------
# IDDS BINARY TREE
# ALGORITHMS
# ----------------
# getting the maximum depth of the tree
def maxDepth(node):
if node is None:
@wildonion
wildonion / rps.py
Created October 28, 2020 12:21
rock, scissors and paper game using graph data structure
# ROCK | SCISSORS | PAPER
class Node:
def __init__(self, data):
self.data = data
self._to = []
self._from = []
self.right = None
@wildonion
wildonion / unival.py
Created October 28, 2020 12:21
unival problem
class node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
self.id = None
@wildonion
wildonion / wist.py
Last active October 28, 2020 12:33
weight independent set tree algorithm
# WIST algo
import random
# creating Node class
class Node:
def __init__(self, data):
@wildonion
wildonion / arp.py
Last active October 28, 2020 20:42
a simple arpscanner script
#[*****************************************************************************************]
# http://bt3gl.github.io/black-hat-python-infinite-possibilities-with-the-scapy-module.html
#[*****************************************************************************************]
#!/usr/bin/python
import sys
from datetime import datetime
@wildonion
wildonion / bet.py
Created October 28, 2020 19:51
binary expression tree
from stack import stack
class BET():
class Node():
def __init__(self, value):
self.value = value
self.left = None
self.right = None
@wildonion
wildonion / blockchain.js
Last active October 28, 2020 20:41
a simple blockchain using js
//TODO: peer-to-peer network to communicate with other nodes, real proof-of-work according to bitcoin wiki
//TODO: merkle tree for data transactions, replaceChain method, data object is not showing, timestamp
//TODO: increase the amount of difficulty after a specific number of block has been mined
//NOTE: Every node in the network holds a copy of the blockchain
// npm install --save body-parser crypto-js ws express
const SHA256 = require('crypto-js/sha256');
const express = require("express");