This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import os | |
import random | |
import sys | |
import time | |
from pyqrack import Pauli, QrackSimulator, QrackCircuit | |
from qiskit.visualization import plot_bloch_multivector, plot_histogram, circuit_drawer | |
from qiskit import QuantumCircuit, transpile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
struct myStruct | |
{ | |
int id; | |
char *name; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global start | |
section .data | |
prompt db "Enter Something... " | |
section .bss | |
buffer: resw 4 | |
outstring: resw 4 | |
section .text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inputs: | |
x - 0 | |
y - 1 | |
z - 0 | |
f(x,y,z) = (x || y) && z | |
(0 || 1) = 1 | |
1 && 0 = 0 |
NewerOlder