Skip to content

Instantly share code, notes, and snippets.

View drnickallgood's full-sized avatar

Nick Allgood drnickallgood

View GitHub Profile
qc/ cd qrack/build && cmake -S .. -B .
<no issues>
qc/ make or gmake
In file included from /usr/include/c++/v1/functional:494:
/usr/include/c++/v1/memory:3710:5: error: destructor called on non-final 'Qrack::StateVectorSparse' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
__data_.second().~_Tp();
^
@drnickallgood
drnickallgood / h6.c
Last active May 1, 2017 01:39
Floyd Warshall
#include <stdio.h>
#include <stdlib.h>
void printMatrix(int matrix[4][4], int size) {
int i = 0;
int j = 0;
for(i = 0; i <size; i++) {
for(j = 0; j <size; j++) {
printf("%d, ", matrix[i][j]);
@drnickallgood
drnickallgood / Big O Quiz
Created January 11, 2017 18:10
Big O Quiz
What is the big-O performance estimate of the following function?
int f (n) {
int sum = 0;
for (i = 0; i < n; i++)
sum += i;
return sum;
} // end f
my answer - O(n)
@drnickallgood
drnickallgood / Person.java
Created January 11, 2017 00:48
Person Java Class
//Person.java
class Person {
//Static variable for counting Person instances
private static int idCount = 0;
//Instance variables
private Name name;
private int id;
//Constructor initializing instance variables with supplied names
public Person(String firstName, String lastName) {
name = new Name(firstName, lastName);
@drnickallgood
drnickallgood / structasm.c
Last active November 17, 2016 13:11
Struct Assembly example
#include <stdio.h>
int main(void)
{
struct myStruct
{
int id;
char *name;
};
@drnickallgood
drnickallgood / bfsjs-kahn.js
Created November 13, 2016 04:00
BFS Adjacency List - Kahn
/* A Queue object for queue-like functionality over JavaScript arrays. */
var Queue = function() {
this.items = [];
};
Queue.prototype.enqueue = function(obj) {
this.items.push(obj);
};
Queue.prototype.dequeue = function() {
return this.items.shift();
};
[ 115, 20, 99, 200, 59]
inspect and store pos 1 in list (20)
is pos-1 > stored?
yes
move 115 over one spot to pos1
[ 115, 115, 99, 200, 59] [ 20]
counter is pos - 2
is value at counter > value at pos ? no
global start
section .data
prompt db "Enter Something... "
section .bss
buffer: resw 4
outstring: resw 4
section .text
inputs:
x - 0
y - 1
z - 0
f(x,y,z) = (x || y) && z
(0 || 1) = 1
1 && 0 = 0
import os
import time
import sys
# Function to execute shell commands "built ins"
#
def executeBuiltin(cmd):
if cmd[0] == "pwd": # Rudimentary builtin check
pwd()
elif cmd[0] == "cd":