Skip to content

Instantly share code, notes, and snippets.

View labgeek's full-sized avatar

JD labgeek

  • Seattle, WA
View GitHub Profile
@labgeek
labgeek / populate.c
Created July 20, 2020 12:56
Part of bigger program written to handle merge sort and quick sort analysis. Simple c program to randomize numbers up to 100 and pass back pointer to first element in array.
/**
* @author JD Durick
* @date 3/11/1998
* Assignment: part of bigger program written to handle
merge sort and quick sort analysis
*/
#include <stdio.h> //header file for input/output
@labgeek
labgeek / pointer.c
Created July 22, 2020 13:14
Simple hackerrank program - C
#include <stdio.h>
#include <math.h>
void update(int *a,int *b) {
int ans1, ans2;
ans1 = *a + *b;
ans2 = abs(*a-*b); //absolute via math.h
printf("%d\n%d", ans1, ans2);
}
#include <stdio.h>
#include <stdlib.h>
void rArray(int *, int);
int main()
{
int num, *arr, i;
scanf("%d", &num);
arr = (int*) malloc(num * sizeof(int));
for(i = 0; i < num; i++) {
/*
* List.h
*
* Created on: Jul 20, 2020
* Author: labgeek@gmail.com
*/
#ifndef LIST_H_
#define LIST_H_
/*
* List.cpp
*
* Created on: Jul 20, 2020
* Author: labgeek@gmail.com
*/
#include <iostream>
#include <cstdlib>
#include "List.h";
#include <stdio.h>
#include <string.h>
int main(){
char *s;
s = malloc(1024 * sizeof(char));
scanf("%[^\n]", s);
// printf("%s", s);
char *token = strtok(s, " ");
/*
* Sort number using STL vectors
*/
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#include <iostream>
#include <array>
using namespace std;
bool sumOfTwo(int a[], int b[], int v, int len1, int len2)
{
for(int i = 0; i<len1; i++)
{
int needed_value = v - a[i];
for(int j = 0; j<len2; j++){
/*****************************************************************//**
* \file hw6.c
* \brief Counts the number of words of a given length in maxRow sentences
*
* \author labgeek@gmail.com
* \date 4/10/1996
*********************************************************************/
#include <stdio.h>
#include <iostream>
#include <cstring>
using namespace std;
//function prototype
void solve(char[]);
int main()
{
char name[100] = { 0 };
char result;