
模板
Shudderwock7
这个作者很懒,什么都没留下…
展开
-
队列,链表实现,不带头节点
// Linked Queue, without head node#include <iostream>using namespace std;template <typename T>struct Node{ T data; Node<T> *next;};template <typename T>class LinkedQueue{public: LinkedQueue() {} ~LinkedQ原创 2021-04-19 12:58:39 · 177 阅读 · 0 评论 -
循环队列,不浪费一个数组空间
// Circular Queue, without wasting an array of space#include <iostream>using namespace std;template <typename T>class Queue{private: int _rear, _front; int _max_size; int *arr;public: Queue(int s) { _front原创 2021-04-19 12:57:33 · 716 阅读 · 0 评论 -
循环队列,浪费一个数组空间
// Circular Queue, with wasting an array of space#include <iostream>using namespace std;template <typename T>class Queue{private: int _rear, _front; int _max_size; int *arr;public: Queue(int s) { _front = 0原创 2021-04-19 12:56:36 · 412 阅读 · 0 评论 -
队列,链表实现,带头节点
// Linked Queue, with head node#include <iostream>using namespace std;template <typename T>struct Node{ T data; Node<T> *next;};template <typename T>class LinkedQueue{private: Node<T> *_first, *_last;原创 2021-04-19 12:55:02 · 107 阅读 · 0 评论 -
栈(链表实现)
// SeqStack_main.cpp#include <iostream>using namespace std;#include "SeqStack.cpp"int main(){ SeqStack<int> S; if (S.Empty()) cout << "栈为空\n"; else cout << "栈非空\n"; cout << "对15和10执行入栈操作\原创 2021-04-07 21:51:46 · 86 阅读 · 0 评论 -
多项式加法
#include <algorithm>#include <cmath>#include <iostream>#define eps (1e-8)using namespace std;struct Elem{ double coef; int exp; bool operator<(const Elem &b) { return exp < b.exp; }};struct Node{ Elem原创 2021-04-07 21:49:41 · 114 阅读 · 0 评论 -
双向循环链表
// main.cpp#include "DoublyCircularLinkedList.cpp"#include <iostream>using namespace std;int main(){ int r[5] = {1, 2, 3, 4, 5}; DoublyCircularLinkedList<int> L(r, 5); // DoublyCircularLinkedList<int> L(r, 0); cout原创 2021-04-07 21:48:58 · 84 阅读 · 0 评论 -
循环链表
// main.cpp#include "CircularLinkedList.cpp"#include <iostream>using namespace std;int main(){ int r[5] = {1, 2, 3, 4, 5}; CircularLinkedList<int> L(r, 5); cout << "链表长度:" << L.Length() << endl; cout &原创 2021-04-07 21:44:08 · 86 阅读 · 0 评论 -
双向链表
// main.cpp#include "DoublyLinkedList.cpp"#include <iostream>using namespace std;int main(){ int r[5] = {1, 2, 3, 4, 5}; DoublyLinkedList<int> L(r, 5); cout << "链表长度:" << L.Length() << endl; cout <&原创 2021-04-07 21:46:36 · 88 阅读 · 0 评论 -
BigInteger 类(高精度亿进制)模板 - 也许是全网最好的 BigInteger 高精度模板
高精度亿进制模板,支持负数,支持通过整型和字符串赋值,支持加减乘除取模等算术运算符,支持比较运算符,支持+=,-=,*=,/=,%-,支持用 cin 和 cout 直接输入输出。抄了之后直接当成 int 来用也问题不大。也许是全网最好的 BigInteger 高精度模板。#include <algorithm>#include <cstring>#include <iostream>#include <string>#include <vec原创 2021-03-22 22:08:17 · 198 阅读 · 0 评论