Skip to content

Instantly share code, notes, and snippets.

View msmoiz's full-sized avatar

Mustafa S. Moiz msmoiz

View GitHub Profile
@msmoiz
msmoiz / InterfaceDemo.h
Created April 8, 2021 17:30
Interface Demo for Unreal Engine 4
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "InterfaceDemo.generated.h"
UINTERFACE()
class UBaseInterface : public UInterface
{
GENERATED_BODY()
@msmoiz
msmoiz / main.cpp
Created April 9, 2021 21:56
C++ Command Line Compilation Demo Source
#include <iostream>
#define GOODBYE std::cout << "Goodbye World!" << std::endl;
int main()
{
std::cout << "Hello World!" << std::endl;
GOODBYE;
#ifdef KIDDING
std::cout << "Just kidding!" << std::endl;
@msmoiz
msmoiz / main.cpp
Created April 13, 2021 01:29
Source and header files accompanying the Unrealistic.dev post on complex C++ compilation from the command line.
#include "static.h"
#include "shared.h"
#include <iostream>
void local_hello()
{
std::cout << "Hello local world!" << std::endl;
}
int main()
@msmoiz
msmoiz / client.cpp
Created May 20, 2021 19:19
Implementing a Stack Using a Dynamic Array in C++
#include <string>
#include "stack.h"
int main()
{
Stack<std::string> notes;
notes.push("Hey");
notes.push("what's");
notes.push("up.");
@msmoiz
msmoiz / client.cpp
Last active May 21, 2021 23:33
Implementing a Queue Using a Linked List in C++
#include <iostream>
#include <string>
#include "queue.h"
int main()
{
Queue<std::string> orders;
orders.enqueue("burger");
orders.enqueue("fries");
@msmoiz
msmoiz / client.cpp
Last active May 23, 2021 22:53
Using Union-Find to Trace Connections in C++
#include <iostream>
#include "unionfind.h"
int main(int argc, const char* argv[])
{
int node_count;
std::cin >> node_count;
std::cout << "Size: " << node_count << std::endl;
@msmoiz
msmoiz / selection-sort.h
Last active June 1, 2021 18:22
Selection Sort
template<typename T>
void exchange(Vector<T>& list, int i, int j)
{
T temp = list[i];
list[i] = list[j];
list[j] = temp;
}
/**
* In a typical selection sort (a simple, but inefficient
@msmoiz
msmoiz / insertion-sort.h
Last active June 2, 2021 21:07
Insertion Sort
#include <vector>
template<typename T>
void exchange(vector<T>& list, int i, int j)
{
T temp = list[i];
list[i] = list[j];
list[j] = temp;
}
template<typename T>
void exchange(vector<T>& list, int i, int j)
{
T temp = list[i];
list[i] = list[j];
list[j] = temp;
}
/**
* Part of the drawback of the insertion sort
#include <vector>
template<typename T>
void exchange(vector<T>& list, int i, int j)
{
T temp = list[i];
list[i] = list[j];
list[j] = temp;
}