Skip to content

Instantly share code, notes, and snippets.

View voidnerd's full-sized avatar
:octocat:
Debugging

Ndifreke Friday voidnerd

:octocat:
Debugging
View GitHub Profile
class Node {
constructor(data) {
this.data = data;
this.next = null;
}
}
class LinkedList {
constructor () {
this.head = null;
this.size = 0;
class Node {
constructor(data) {
this.left;
this.right;
this.data = data;
}
insert(value) {
if(value < this.data) {
if(this.left == null) {
class Node {
constructor(data, left = null, right = null) {
this.left = left;
this.right = right;
this.data = data;
}
}
class BST {
constructor() {
@voidnerd
voidnerd / credit.c
Last active April 11, 2020 02:38
A solution for Harvard / edX CS50 week 1 luhn algorithm credit card verification assignment
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void) {
long card_no;
do{
card_no = get_long("Card Number: ");
}while(card_no < 1);
@voidnerd
voidnerd / mario.c
Created April 11, 2020 02:41
A solution for Harvard / edX CS50 week 1 Mario World 1-1
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
do {
n = get_int("height: ");
}while(n < 1 || n > 8);
@voidnerd
voidnerd / readability.c
Last active April 19, 2020 21:05
CS50's Problem Set 2 - Readablity
#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int main(void)
{
string text = get_string("Text:");
@voidnerd
voidnerd / caesar.c
Last active April 19, 2020 21:05
CS50's Problem Set 2 - Caesar Cipher
#include <stdio.h>
#include <ctype.h>
#include <cs50.h>
#include <string.h>
#include <stdlib.h>
bool isNumber(char number[]);
int main(int argc, string argv[])
{
@voidnerd
voidnerd / substitution.c
Created April 19, 2020 21:04
CS50's Problem Set 2 - Substitution
#include <stdio.h>
#include <ctype.h>
#include <cs50.h>
#include <string.h>
#include <stdlib.h>
bool isAlpha(string key);
bool hasDuplicates(string key);
int main(int argc, string argv[])
@voidnerd
voidnerd / plurality.c
Created April 19, 2020 21:06
CS50's Problem Set 3 - Plurality
#include <cs50.h>
#include <stdio.h>
#include <string.h>
// Max number of candidates
#define MAX 9
// Candidates have name and vote count
typedef struct
{
@voidnerd
voidnerd / runoff.c
Created April 26, 2020 23:44
CS50 Problem Set 3 - Runoff
#include <cs50.h>
#include <stdio.h>
#include <string.h>
// Max voters and candidates
#define MAX_VOTERS 100
#define MAX_CANDIDATES 9
// preferences[i][j] is jth preference for voter i
int preferences[MAX_VOTERS][MAX_CANDIDATES];