Skip to content

Instantly share code, notes, and snippets.

View hckim16's full-sized avatar

Hyo Chang Kim hckim16

View GitHub Profile
@hckim16
hckim16 / varSizeArray.cpp
Created February 24, 2018 02:57
Hackerrank C++ Variable Sized Arrays challenge
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
@hckim16
hckim16 / modulo.cpp
Created February 13, 2018 05:39
Coding loop, modulo and following directions
//This simple code assumes numbers manually inputted via cout/cin
//input can be entered number of ways to include std stream of string data
//input may change but general coding logic straightforward and will not change
//for loop can apply to any "FizzBuzz" problem
#include <iostream>
//add appropriate libraries
using namespace std;
@hckim16
hckim16 / factorial.cpp
Last active February 4, 2018 16:59
Simple recursive code for factorial solution
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int factorial(int n){
if(n == 0){
return 1;
@hckim16
hckim16 / leftRotate.cpp
Last active February 4, 2018 16:59
left rotation using standard libraries - vector and algorithm
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> left_rotate(vector<int>array, int r){
rotate(array.begin(), array.begin()+r, array.end());
return array;
}
@hckim16
hckim16 / hash.cpp
Created February 2, 2018 04:32
Code comes from an outstanding set of lessons from Paul Programming, https://www.youtube.com/watch?v=MfhjkfocRR0&t=266s
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
class h
{
private:
static const int tableSize = 5; //sets table size
@hckim16
hckim16 / sumDiagonal.cpp
Created February 1, 2018 12:09
Summing across diagonals and abs value of subtracting diagonal sums
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
@hckim16
hckim16 / runningmedian.cpp
Last active January 31, 2018 06:17
Find Running Median
#include <cmath>
#include <queue>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
@hckim16
hckim16 / Singly Linked List
Created October 2, 2017 16:10
Singly linked list with traverse and search functions, credit and help cited
//courseID:CIS277-001
//name: Hyo Chang Kim
//Prof. Eliscu
//Homework Assignment#4: Singly Linked List
//Due by 2/21/2017
/*
I had a few challenges on this assignment. I wrote the code for creating a singly linked list that accepted the airport codes and miles as values. I wrote it as a do-while loop after setting the initial node to LGA and zero miles. The do-while then adds as many nodes as inputted to the last position. I wrote a second do-while loop with switch menu to give the user the option of displaying the entire list or to search for a specific code.
*/
@hckim16
hckim16 / Finite State Machine
Last active March 19, 2018 12:18
Program models finite state automaton
/*
This program that models a finite state automaton assigns conditions 0 to 4 that models state zero to state 4.
It only considers 0 and 1 as input. It only moves from state to state based on the input of 1101. Any other combinatin,
be it 1 and 0 or any other input will not move the state from zero to four.
I had considered using enum values to assign "words to integers" but decided to stay with integers for simplicity sake.
*/
#include<iostream>
using namespace std;
@hckim16
hckim16 / Airport Check-in simulation
Created September 30, 2017 02:24
Simulation check in at an airport counter with 2 queues and 2 first class counters for the first class queue and 3 coach class counters for the coach queue.
//Hyo Chang Kim
//Kim-CS610-2017-programming assignment 1
//Professor Ali Mili
/*
Input:
1. Duration of Simulation
2. Average Coach Class Passenger Arrival Time
3. Average Coach Class Service Time
4. Average First Class Passenger Arrival Time
5. Average First Class Service Time