Skip to content

Instantly share code, notes, and snippets.

View bricksphd's full-sized avatar

Ricks bricksphd

View GitHub Profile
@bricksphd
bricksphd / bst.py
Created October 11, 2022 19:10
Starter code for project 4, binary search trees
"""
Node class for the binary search tree.
Unlike other projects, feel free to add additional functions here.
For example, if may be helpful to have a height() method, etc.
Some students prefer to implement the recursive add, remove, and contains functions
in Node while other keep the recursive functions in BST
"""
class Node:
@bricksphd
bricksphd / return.py
Created September 20, 2022 16:47
Broken return value in python
def reverse(list):
newList = []
for value in range(len(list), 0, -1):
newList.append(value)
return newList
"""Broken..."""
def helper(list):
reverse(list)
@bricksphd
bricksphd / print.py
Created September 19, 2022 18:17
Print a list as if it were a merge sort
list = [4,3,5,3,7,6]
def printList(l):
if len(l) <= 0:
return
if len(l) == 1:
print(l[0])
return
leftList = []
rightList = []
@bricksphd
bricksphd / hashtable.py
Created September 14, 2022 15:25
Project 3
"""
For this assignment you need to implement a hash table using the following
class definitions. You may add additional functions as needed.
"""
"""
Hash Table Class:
The class that you will use to implement the hash table.
Note, you may not use any of python's built in classes to implement this class.
"""
@bricksphd
bricksphd / list.py
Created September 14, 2022 14:52
Project 2
"""
For this assignment you need to implement a linked list using the following
class definition. You may add addition functions as needed.
"""
""""
Node Class:
Every item in your linked list will be encapsulated in this class.
value is the item encapsulated by the node.
next is a pointer to the next node in line. This will be None if it
@bricksphd
bricksphd / list-starter.py
Created August 11, 2022 14:40
Starter code for a CSCI 3320 Data Structures Assignment. Created by B. Ricks @ University of Nebraska at Omaha
"""
Programming assignment file for CSCI3320, Fall 2022
The University of Nebraska at Omaha
When this assignment is completed correctly, the console output should be:
Printing in order: 1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> None,
Printing in reverse order: 5 -> None, 4 -> 5, 3 -> 4, 2 -> 3, 1 -> 2,
Reversing the list ... Printing the reversed list in order: 5 -> 4, 4 -> 3, 3 -> 2, 2 -> 1, 1 -> None,
Making a doubly-linked list ... Printing doubly-linked list version: 5 -> 4, 5 <- 4 -> 3, 4 <- 3 -> 2, 3 <- 2 -> 1, 2 <- 1 -> None,
@bricksphd
bricksphd / index.js
Created May 6, 2022 20:45
The Greek alphabet as individual strings in javascript
let greekUpperCase = [
"Α", "B", "Γ", "Δ", "Ε", "Z", "H", "Θ", "I", "K", "Λ", "M", "N", "Ξ", "O", "Π", "P", "Σ", "T", "Y", "Φ", "X", "Ψ", "Ω"
]
let greekLowerCase = [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"
]
@bricksphd
bricksphd / transform.py
Created April 26, 2022 15:04
Apply a matrix to an object in Blender
# From https://blender.stackexchange.com/a/129717/117607
import bpy
from mathutils import Matrix
ob = bpy.context.object
me = ob.data
M = Matrix((
(1, 0, 0, 0),
(0, 1, 0, 0),
@bricksphd
bricksphd / blender.py
Created April 26, 2022 14:58
Display the matrix of an object's transform in Blender
import bpy
ob = bpy.context.object
print(ob.matrix_world)
@bricksphd
bricksphd / Main.java
Created October 28, 2021 16:00
Proposed driver for CSCI 3320 ICollection projects
public class Main {
/**
* A custom class to demonstrate that we can work on a variety of object types
*/
static class Pet implements Comparable<Pet> {
String name;
public Pet(String name) {
this.name = name;