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
#ifndef bfs_hpp | |
#define bfs_hpp | |
#include "digraph.hpp" | |
#include "queue.hpp" | |
class BFS { | |
private: | |
bool *seen; | |
int *pred; | |
void init(Digraph& G) { |
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
#ifndef bag_hpp | |
#define bag_hpp | |
template <class T> | |
class BagIter { | |
private: | |
T* curr; | |
public: | |
BagIter(T* pos) { | |
curr = pos; |
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
#include <iostream> | |
using namespace std; | |
struct node { | |
int info; | |
node* next; | |
node(int i = 0, node* n = nullptr) : info(i), next(n) { } | |
}; |
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
#ifndef simple_deque_hpp | |
#define simple_deque_hpp | |
template <class T> | |
class simple_deque_iterator; | |
template <class T> | |
class simple_deque { | |
private: | |
using iterator = simple_deque_iterator<T>; |
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
const int M = 4; | |
template <class K, class V> | |
struct node; | |
template <class K, class V> | |
struct entry { | |
K key; | |
V value; | |
node<K,V>* next; |
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
/* | |
Example of how mark/sweep garbage collection works. | |
MIT License | |
Copyright (c) 2023 Max Goren - http://www.maxgcoding.com | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal |
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
#include <iostream> | |
using namespace std; | |
template <class T> | |
void print(T a[], int n) { | |
for (int i = 0; i < n; i++) { | |
cout<<a[i]<<" "; | |
} | |
cout<<endl; | |
} |
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
#include <vector> | |
#include <limits> | |
#include <iostream> | |
#include <SFML/Graphics.hpp> | |
using namespace std; | |
template <class K, class V> | |
struct rbnode { | |
K key; | |
V value; |
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
class Evaluate { | |
private: | |
template <class T> | |
struct Stack : public stack<T> { | |
T pop() { | |
T ret = stack<T>::top(); | |
stack<T>::pop(); | |
//cout<<"Pop: "<<ret<<endl; | |
return ret; | |
} |
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
import java.util.Random; | |
public class SkipList { | |
private static final int MAX_LEVEL = 7; | |
private Random rng; | |
private class Node { | |
public Character info; | |
public int level; | |
public Node[] forward; | |
Node(char i, int level) { |
NewerOlder