This file contains 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
// | |
// Created by Ben Napier on 08/03/2019. | |
// | |
#include <iostream> | |
#include "Graph.h" | |
int main() { | |
// Lets implement a bit of Prim's... | |
// First set up our graph. | |
Graph graph; |
This file contains 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
% Typical maths | |
\usepackage{amssymb} % Cool symbols like \mathbb{R} | |
\usepackage{bm} % Bold symbols, \bm{v} | |
\usepackage{mathtools} % Main maths package, imports amsmath | |
\usepackage{enumitem} % allows next line | |
\setlist[enumerate,1]{label={(\roman*)}} % changing default numbering scheme | |
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert} % absolute operator | |
% Probability | |
\usepackage{mathtools} |
This file contains 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
void bucket_sort(int data_array[], int array_size) { | |
// First we find the maximum value in the list so we know how much space to allocate. | |
int maximum_value = 0; | |
for (int i = 0; i < array_size; ++i) { | |
if (data_array[i] > maximum_value) { | |
maximum_value = data_array[i]; | |
} | |
} | |
auto bucket_vector = std::vector<unsigned >(static_cast<unsigned int>(maximum_value + 1)); | |
// And now we fill our buckets. |
This file contains 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
#define MAX_SIZE 32 | |
/** | |
* Implementation of a queue data type using an array. | |
*/ | |
class QueueWithArray { | |
private: | |
int data_array[MAX_SIZE] = {}; | |
int size = 0; | |
int front_index = 0; |
This file contains 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
#define MAX_SIZE 32 | |
/** | |
* Implementation of a stack data type using an array. | |
*/ | |
class Stack { | |
private: | |
int data_array[MAX_SIZE] = {}; | |
int size = 0; | |
public: |
This file contains 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
/** | |
* Simple node data structure for a circularly linked list. | |
*/ | |
class Node { | |
public: | |
Node *next = nullptr; | |
int data; | |
}; | |
/** |
This file contains 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
/** | |
* Simple node data structure for a doubly linked list. | |
*/ | |
class Node { | |
public: | |
Node *next = nullptr; | |
Node *prev = nullptr; | |
int data; | |
}; |
This file contains 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
/** | |
* Simple node data structure for a singly linked list. | |
*/ | |
class Node { | |
public: | |
Node *next = nullptr; | |
int data; | |
}; | |
/** |
This file contains 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
table <- tibble(Measure = numeric(), Percent = numeric(), Count = numeric()) | |
for (i in seq(main$Measure %>% quantile(0.01) %>% round(1), max(main$Measure), 0.1)) { | |
main.sub <- main %>% filter(Measure > i) | |
prop.count <- main.sub$IsCondition %>% which() %>% length() | |
count <- main.sub %>% nrow() | |
if (prop.count < 30) { | |
break | |
} | |
table <- table %>% add_row(Measure = i, | |
Percent = 100 * prop.count / count, |
This file contains 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
ggplot(data)+ | |
geom_point(aes(Value.X, Value.Y), shape = 0) |
NewerOlder