Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //#include <vector>
- #include <Windows.h>
- using namespace std;
- class list {
- public:
- unsigned long long size;
- bool* masterlist;
- list() {
- masterlist = new bool[1];
- size = 1;
- }
- list(unsigned long long ull) {
- masterlist = new bool[ull];
- size = ull;
- }
- ~list() {
- if (masterlist) {
- delete masterlist;
- }
- }
- void Realloc(unsigned long long ull) {
- bool* m = new bool[ull];
- ZeroMemory(m, ull);
- //good place for a size check
- memcpy(m, masterlist, size);
- delete masterlist;
- masterlist = m;
- size = ull;
- }
- bool& operator[](unsigned long long ull) {
- if (ull > size - 1) { Realloc(ull + 1); }
- return masterlist[ull];
- }
- void print() {
- for (unsigned long long ull = 0; ull < size; ull++) {
- if(masterlist[ull])
- cout << ull << '\n';
- }
- }
- };
- class node {
- public:
- node* prev;
- node* next;
- int num;
- node() :prev{ nullptr }, next{ nullptr }, num{ 0 }{}
- node(int num=0,node* prev = nullptr, node* next = nullptr) :prev{ prev }, next{ next }, num{ num }{}
- node(node* prev) : num{ 0 }, prev{ prev }, next{ nullptr }{}
- node* Next() { return next; }
- node* Prev() { return prev; }
- };
- unsigned long long xPlusOne(unsigned long long ull) {
- if (ull & 1) { return (ull * 3) + 1; } //0dd
- return ull >> 1; //bitwise operations... beastmode unlocked
- }
- int main() {
- unsigned long long in = 3;
- list l;
- do {
- in = xPlusOne(in);
- l[in] = true;
- } while (in != 1);
- l.print();
- }
Add Comment
Please, Sign In to add comment