Skip to content

Commit

Permalink
Sort and group include directives
Browse files Browse the repository at this point in the history
  • Loading branch information
landerrosette committed Jan 20, 2025
1 parent ff11447 commit f376f86
Show file tree
Hide file tree
Showing 82 changed files with 174 additions and 96 deletions.
1 change: 1 addition & 0 deletions AcyclicSP.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "AcyclicSP.h"

#include "Topological.h"

AcyclicSP::AcyclicSP(const EdgeWeightedDigraph &G, int s) : SP(G, s) {
Expand Down
3 changes: 2 additions & 1 deletion BST.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#define ALGS4_BST_H


#include "OrderedST.h"
#include <memory>
#include <utility>

#include "OrderedST.h"

template<typename Key, typename Value>
class BST : public OrderedST<Key, Value> {
protected:
Expand Down
1 change: 1 addition & 0 deletions BellmanFordSP.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "BellmanFordSP.h"

#include "DirectedCycle.h"

void BellmanFordSP::onRelaxationSuccess(const EdgeWeightedDigraph &G, int v, const DirectedEdge &e, int w) {
Expand Down
5 changes: 3 additions & 2 deletions BellmanFordSP.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define BELLMANFORDSP_H


#include "SP.h"
#include <vector>
#include <list>
#include <vector>

#include "SP.h"

class BellmanFordSP : public SP {
private:
Expand Down
3 changes: 2 additions & 1 deletion BinarySearchST.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#define ALGS4_BINARYSEARCHST_H


#include "OrderedST.h"
#include <optional>
#include <vector>

#include "OrderedST.h"

template<typename Key, typename Value>
class BinarySearchST : public OrderedST<Key, Value> {
private:
Expand Down
1 change: 1 addition & 0 deletions BinaryStdIO.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "BinaryStdIO.h"

#include <iostream>

void BinaryStdIO::writeBit(std::byte bit) {
Expand Down
2 changes: 1 addition & 1 deletion BinaryStdIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define BINARYSTDIO_H


#include <string>
#include <cstddef>
#include <string>

class BinaryStdIO {
private:
Expand Down
1 change: 1 addition & 0 deletions BoyerMoore.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "BoyerMoore.h"

#include <utility>

// Compute skip table.
Expand Down
5 changes: 3 additions & 2 deletions BoyerMoore.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define BOYERMOORE_H


#include "SubstrSearcher.h"
#include <vector>
#include <string>
#include <vector>

#include "SubstrSearcher.h"

class BoyerMoore : public SubstrSearcher {
private:
Expand Down
1 change: 1 addition & 0 deletions BreadthFirstPaths.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "BreadthFirstPaths.h"

#include <queue>

void BreadthFirstPaths::bfs(const Graph &G, int s) {
Expand Down
3 changes: 2 additions & 1 deletion CCBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_CCBASE_H


#include "GraphBase.h"
#include <vector>

#include "GraphBase.h"

class CCBase {
protected:
std::vector<bool> marked;
Expand Down
5 changes: 3 additions & 2 deletions DepthFirstOrder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#define ALGS4_DEPTHFIRSTORDER_H


#include "GraphBase.h"
#include <list>
#include <type_traits>
#include <vector>

#include "DirectedEdge.h"
#include <type_traits>
#include "GraphBase.h"

class DepthFirstOrder {
private:
Expand Down
3 changes: 2 additions & 1 deletion Digraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_DIGRAPH_H


#include "GraphBase.h"
#include <iostream>

#include "GraphBase.h"

class Digraph : public GraphBase<int> {
public:
explicit Digraph(int V) : GraphBase(V) {}
Expand Down
2 changes: 1 addition & 1 deletion DijkstraSP.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define DIJKSTRASP_H


#include "SP.h"
#include "IndexMinPQ.h"
#include "SP.h"

class DijkstraSP : public SP {
private:
Expand Down
7 changes: 4 additions & 3 deletions DirectedCycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@


#include <list>
#include "GraphBase.h"
#include <vector>
#include "DirectedEdge.h"
#include <optional>
#include <type_traits>
#include <vector>

#include "DirectedEdge.h"
#include "GraphBase.h"

template<typename T>
class DirectedCycle {
Expand Down
5 changes: 3 additions & 2 deletions DirectedDFS.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_DIRECTEDDFS_H


#include "Digraph.h"
#include <vector>
#include <list>
#include <vector>

#include "Digraph.h"

class DirectedDFS {
private:
Expand Down
5 changes: 3 additions & 2 deletions DirectedEdge.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define DIRECTEDEDGE_H


#include "Edge.h"
#include <iostream>
#include <iomanip>
#include <iostream>

#include "Edge.h"

class DirectedEdge : private Edge {
public:
Expand Down
1 change: 1 addition & 0 deletions Edge.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Edge.h"

#include <stdexcept>

int Edge::other(int vertex) const {
Expand Down
2 changes: 1 addition & 1 deletion Edge.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define ALGS4_EDGE_H


#include <iostream>
#include <iomanip>
#include <iostream>

class Edge {
protected:
Expand Down
5 changes: 3 additions & 2 deletions EdgeWeightedDigraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#define EDGEWEIGHTEDDIGRAPH_H


#include "GraphBase.h"
#include "DirectedEdge.h"
#include <iostream>
#include <list>

#include "DirectedEdge.h"
#include "GraphBase.h"

class EdgeWeightedDigraph : public GraphBase<DirectedEdge> {
public:
explicit EdgeWeightedDigraph(int V) : GraphBase(V) {}
Expand Down
5 changes: 3 additions & 2 deletions EdgeWeightedGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#define ALGS4_EDGEWEIGHTEDGRAPH_H


#include "GraphBase.h"
#include "Edge.h"
#include <iostream>
#include <list>

#include "Edge.h"
#include "GraphBase.h"

class EdgeWeightedGraph : public GraphBase<Edge> {
public:
explicit EdgeWeightedGraph(int V) : GraphBase(V) {}
Expand Down
3 changes: 2 additions & 1 deletion Graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_GRAPH_H


#include "GraphBase.h"
#include <iostream>

#include "GraphBase.h"

class Graph : public GraphBase<int> {
public:
explicit Graph(int V) : GraphBase(V) {}
Expand Down
2 changes: 1 addition & 1 deletion GraphBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define ALGS4_GRAPHBASE_H


#include <iostream>
#include <list>
#include <vector>
#include <iostream>

template<typename T>
class GraphBase {
Expand Down
3 changes: 2 additions & 1 deletion Heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_HEAP_H


#include "Sorting.h"
#include <utility>

#include "Sorting.h"

class Heap : public Sorting {
private:
template<typename T>
Expand Down
6 changes: 4 additions & 2 deletions Huffman.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "Huffman.h"
#include "MinPQ.h"
#include "BinaryStdIO.h"

#include <iostream>
#include <vector>

#include "BinaryStdIO.h"
#include "MinPQ.h"

// Make a lookup table from trie.
std::vector<std::string> Huffman::buildCode(const std::shared_ptr<Node> &root) {
std::vector<std::string> st(R);
Expand Down
5 changes: 3 additions & 2 deletions IndexMinPQ.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_INDEXMINPQ_H


#include "MinPQ.h"
#include <vector>
#include <optional>
#include <vector>

#include "MinPQ.h"

template<typename Key>
class IndexMinPQ : private MinPQ<int> {
Expand Down
1 change: 1 addition & 0 deletions KMP.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "KMP.h"

#include <utility>

// Build DFA from pattern.
Expand Down
5 changes: 3 additions & 2 deletions KMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define KMP_H


#include "SubstrSearcher.h"
#include <vector>
#include <string>
#include <vector>

#include "SubstrSearcher.h"

class KMP : public SubstrSearcher {
private:
Expand Down
1 change: 1 addition & 0 deletions KosarajuSCC.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "KosarajuSCC.h"

#include "DepthFirstOrder.h"

KosarajuSCC::KosarajuSCC(const Digraph &G) : CCBase(G) {
Expand Down
1 change: 1 addition & 0 deletions KruskalMST.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "KruskalMST.h"

#include "MinPQ.h"
#include "UF.h"

Expand Down
3 changes: 2 additions & 1 deletion KruskalMST.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define KRUSKALMST_H


#include "MST.h"
#include <list>

#include "EdgeWeightedGraph.h"
#include "MST.h"

class KruskalMST : public MST {
private:
Expand Down
6 changes: 4 additions & 2 deletions LZW.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "LZW.h"
#include "TST.h"

#include <string>
#include "BinaryStdIO.h"
#include <vector>

#include "BinaryStdIO.h"
#include "TST.h"

void LZW::compress() {
std::string input = BinaryStdIO::readString();
TST<int> st;
Expand Down
5 changes: 3 additions & 2 deletions LinearProbingHashST.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#define ALGS4_LINEARPROBINGHASHST_H


#include "ST.h"
#include <vector>
#include <functional>
#include <optional>
#include <vector>

#include "ST.h"

template<typename Key, typename Value>
class LinearProbingHashST : public ST<Key, Value> {
Expand Down
1 change: 1 addition & 0 deletions MSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


#include <string_view>

#include "Sorting.h"
#include "StringSorting.h"

Expand Down
3 changes: 2 additions & 1 deletion MST.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_MST_H


#include "Edge.h"
#include <list>

#include "Edge.h"

class MST {
public:
virtual ~MST() = default;
Expand Down
3 changes: 2 additions & 1 deletion MaxPQ.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define ALGS4_MAXPQ_H


#include "PQ.h"
#include <optional>

#include "PQ.h"

template<typename Key>
class MaxPQ : public PQ<Key> {
private:
Expand Down
Loading

0 comments on commit f376f86

Please sign in to comment.