Skip to content

Instantly share code, notes, and snippets.

View Basemera's full-sized avatar

Basemera Phiona Basemera

View GitHub Profile
<?php
/**
* This is a class for creating the binary nodes
*/
class BinaryNode {
private $data;
private $left;
private $right;
<?php
/**
* Class for creating the binary tree
*/
class BinaryTree {
private $root = null;
public function __construct() {
$this->root = null;
import json
class HashTable:
def __init__(self) -> None:
self.count = 0
self.store = {}
def add_val(self, values):
# common interview question to find duplicates in a list
duplicates = set()
import pathlib
from tkinter import filedialog as fd
def open_file_selection():
filenames = fd.askopenfilenames()
print(filenames)
open_file_selection()
import pathlib
from tkinter import filedialog as fd
from PyPDF2 import PdfFileReader
from docx import Document
def open_file_selection():
filenames = fd.askopenfilenames()
for filename in filenames:
extension = pathlib.Path(filename).suffix
if extension == '.pdf':
from tkinter import filedialog as fd
def open_file_selection():
filetypes = (
('pdf files', '*.pdf'),
('doc files', '*.doc')
)
files = fd.askopenfilenames(
filetypes=filetypes,
initialdir='/Users/phionabasemera/Documents/pdfscrapper'
from tkinter import filedialog as fd
def open_file_selection():
file = fd.askopenfile()
print(file.read())
open_file_selection()
from tkinter import filedialog as fd
def open_file_selection():
files = fd.askopenfiles()
for file in files:
print(files)
open_file_selection()
@Basemera
Basemera / browser_history_dll.py
Last active October 1, 2023 20:33
Simple implementation of a browser history app to demonstrate application of the doubly linked list data structure. Also added a file with a few tests
# Creating a simple browser history app using a doubly linked list in Python is a practical project.
# Below is a basic implementation of a browser history app that allows you to navigate through visited websites using a doubly linked list:
class Node:
def __init__(self, url):
self.url = url
self.prev = None
self.next = None
def __repr__(self) -> str:
return self.url
@Basemera
Basemera / doubly_linked_list.py
Created October 3, 2023 00:21
Python implementation for a doubly linkedlist
class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
self.previous = None
class DoublyLinkedList:
def __init__(self) -> None:
self.head = None