|
雷中鑫123456
|
5ms |
6.7 MiB |
|
111 Bytes |
2023-8-24 15:47:37 |
|
时代一校-王宥量 (wangyouliang)
|
5ms |
384 KiB |
|
120 Bytes |
2022-10-29 12:09:34 |
|
Corinna
|
5ms |
6.9 MiB |
|
140 Bytes |
2023-8-19 13:27:38 |
|
六 (江智昕)
|
5ms |
384 KiB |
|
116 Bytes |
2022-12-30 19:42:54 |
|
手搓STL stack 双向无环链表 _ 向量 2种实现方式: template <typename Map_Type> class Stack_l /* Stack _ List */ { private: struct Node { Map_Type Node_Data; Node *nextp, *lastp; Node(void) { nextp = 0; lastp = 0; } }; struct List_Data { unsigned int List_Size; Node *headp, *endp; List_Data(void) { List_Size = 0; headp = 0; endp = 0; } }Data; struct Vector_Data { Map_Type *headp, *lastp, *endp; void resize(unsigned int data_size) { Map_Type *newp = new Map_Type[data_size](); endp = newp + data_size - 1; lastp = newp + (data_size > lastp - headp ? lastp - headp : data_size); if (headp) delete[] headp; headp = newp; } Vector_Data(void) { headp = 0; lastp = 0; endp = 0; } }; public: unsigned int size(void) { return Data.List_Size; } Map_Type& top(void) { return Data.endp -> Node_Data; } void* data(void) { return &Data; } bool empty(void) { return !((bool)Data.headp); } Stack_l<Map_Type>& push(Map_Type push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(Map_Type& push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(Map_Type* push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = *push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(const Map_Type* push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = *(Map_Type*)push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& pop(void) { if (Data.headp) { if (Data.List_Size == 1u) { delete Data.headp; Data.List_Size = 0; Data.headp = 0; Data.endp = 0; } else { Data.endp = Data.endp -> lastp; delete Data.endp -> nextp; Data.endp -> nextp = 0; --Data.List_Size; } } return *this; } Stack_l<Map_Type>& clear(void) { while (Data.List_Size) { pop(); } return *this; } Stack_l<Map_Type>(void) { /* NULL */ } Stack_l<Map_Type>(unsigned int data_size, Map_Type map_data) { Data.List_Size = data_size; while (data_size--) { Node *nodep = new Node(); nodep -> Node_Data = map_data; if (Data.headp) { nodep -> lastp = Data.endp; Data.endp -> nextp = nodep; Data.endp = nodep; } else { Data.headp = nodep; Data.endp = nodep; } } } Stack_l<Map_Type>(Stack_l<Map_Type>& map_data) { if (!map_data.empty()) { List_Data *listp = (List_Data*)map_data.data(); Node *nodep = listp -> headp, *newp; for (unsigned int i = 0; i != listp -> List_Size; ++i, nodep = nodep -> nextp) { newp = new Node(); newp -> Node_Data = nodep -> Node_Data; if (Data.headp) { newp -> lastp = Data.endp; Data.endp -> nextp = newp; Data.endp = newp; } else { Data.headp = newp; Data.endp = newp; } } Data.List_Size = listp -> List_Size; } } Stack_l<Map_Type>& operator=(Stack_l<Map_Type>& copy_data) { if (copy_data.empty()) return *this; List_Data *listp = (List_Data*)copy_data.data(); Node *nodep = listp -> headp, *newp; for (unsigned int i = 0; i != listp -> List_Size; ++i, nodep = nodep -> nextp) { newp = new Node(); newp -> Node_Data = nodep -> Node_Data; if (Data.headp) { newp -> lastp = Data.endp; Data.endp -> nextp = newp; Data.endp = newp; } else { Data.headp = newp; Data.endp = newp; } } Data.List_Size = listp -> List_Size; return *this; } bool operator==(Stack_l<Map_Type>& cmp_data) { if (cmp_data.size() != Data.List_Size) return false; else if (cmp_data.empty() && (!Data.List_Size)) return true; Node *nodep1 = Data.headp, *nodep2 = ((List_Data*)cmp_data.data()) ->headp; for (unsigned int i = 0; i != Data.List_Size; ++i, nodep1 = nodep1 -> nextp, nodep2 = nodep2 ->nextp) { if (nodep1 -> Node_Data != nodep2 -> Node_Data) return false; } return true; } bool operator!=(Stack_l<Map_Type>& cmp_data) { if (cmp_data.size() == Data.List_Size) return false; else if (cmp_data.empty() && (!Data.List_Size)) return false; Node *nodep1 = Data.headp, *nodep2 = ((List_Data*)cmp_data.data()) ->headp; for (unsigned int i = 0; i != Data.List_Size; ++i, nodep1 = nodep1 -> nextp, nodep2 = nodep2 ->nextp) { if (nodep1 -> Node_Data != nodep2 -> Node_Data) return true; } return true; } ~Stack_l<Map_Type>(void) { clear(); } }; /* Stack _ List */ template <typename Map_Type> class Stack_v /* Stack _ Vector */ { private: struct Node { Map_Type Node_Data; Node *nextp, *lastp; Node(void) { nextp = 0; lastp = 0; } }; struct List_Data { unsigned int List_Size; Node *headp, *endp; List_Data(void) { List_Size = 0; headp = 0; endp = 0; } }; struct Vector_Data { Map_Type *headp, *lastp, *endp; void resize(unsigned int data_size) { Map_Type *newp = new Map_Type[data_size](); endp = newp + data_size - 1; lastp = newp + (data_size > lastp - headp ? lastp - headp : data_size); if (headp) delete[] headp; headp = newp; } Vector_Data(void) { headp = 0; lastp = 0; endp = 0; } }Data; public: unsigned int size(void) { return Data.lastp - Data.headp; } Map_Type& top(void) { return *(Data.lastp - 1); } void* data(void) { return &Data; } bool full(void) { if (!Data.headp) return true; return Data.endp + 1 == Data.lastp; } bool empty(void) { if (!Data.headp) return true; return Data.headp == Data.lastp; } Stack_v<Map_Type>& push(Map_Type push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(Map_Type& push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(Map_Type* push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = *push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(const Map_Type* push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = *(Map_Type*)push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& pop(void) { if (empty()) { if (Data.lastp - Data.headp > 1) Data.resize((Data.lastp - Data.headp) >> 1); else return *this; } else --Data.lastp; return *this; } Stack_v<Map_Type>(void) { /* NULL */ } Stack_v<Map_Type>(unsigned int data_size, Map_Type map_data) { while (data_size) { push(&map_data); --data_size; } } Stack_v<Map_Type>(Stack_v<Map_Type>& map_data) { Vector_Data *datap = (Vector_Data*)map_data.data(); for (unsigned int i = 0, k = map_data.size(); i != k; ++i) push(datap -> headp + i); } Stack_v<Map_Type>& operator=(Stack_v<Map_Type>& copy_data) { if (copy_data.empty()) clear(); else { Vector_Data *datap = (Vector_Data*)copy_data.data(); for (unsigned int i = 0, k = copy_data.size(); i != k; ++i) push(datap -> headp + i); } return *this; } bool operator==(Stack_v<Map_Type>& cmp_data) { if (size() != cmp_data.size()) return false; else if (empty() && cmp_data.empty()) return true; Vector_Data *datap = (Vector_Data*)cmp_data.data(); for (unsigned int i = 0, k = size(); i != k; ++i) { if (*(Data.headp + i) != *(datap ->headp + i)) return false; } return true; } bool operator!=(Stack_v<Map_Type>& cmp_data) { if (size() != cmp_data.size()) return true; else if (empty() && cmp_data.empty()) return false; Vector_Data *datap = (Vector_Data*)cmp_data.data(); for (unsigned int i = 0, k = size(); i != k; ++i) { if (*(Data.headp + i) != *(datap -> headp + i)) return true; } return false; } Stack_v<Map_Type>& clear(void) { delete[] Data.headp; Data.headp = 0; Data.lastp = 0; Data.endp = 0; return *this; } ~Stack_v<Map_Type>(void) { delete[] Data.headp; } }; /* Stack _ Vector */ int main(void) { return 0; } (22029-xys)
|
5ms |
440 KiB |
|
2 KiB |
2022-11-5 15:42:38 |
|
爱情海校区—沙天一 (沙天一)
|
5ms |
6.9 MiB |
|
95 Bytes |
2023-7-30 14:12:17 |
|
曹雅萱
|
5ms |
6.9 MiB |
C++11 |
125 Bytes |
2024-8-23 16:24:15 |
|
廖永亨
|
5ms |
520 KiB |
|
133 Bytes |
2022-11-24 18:11:12 |
|
Jack
|
5ms |
512 KiB |
|
112 Bytes |
2022-9-2 20:16:47 |
|
明哲瀚 (18580067605)
|
5ms |
7.1 MiB |
|
121 Bytes |
2023-6-16 20:33:55 |
|
jdy (jdy.)
|
5ms |
6.8 MiB |
|
113 Bytes |
2023-7-4 8:31:47 |
|
yyds (杨骐嘉)
|
5ms |
384 KiB |
|
141 Bytes |
2023-1-14 10:29:42 |
|
余晨浩 (yuchenhao)
|
5ms |
384 KiB |
|
112 Bytes |
2022-8-24 15:23:28 |
|
罗毅川 (scp-049)
|
5ms |
512 KiB |
|
152 Bytes |
2022-10-10 20:33:43 |
|
叶雨昊 (yeyuhao22006)
|
5ms |
436 KiB |
|
116 Bytes |
2022-10-24 20:48:50 |
|
六 (江智昕)
|
5ms |
384 KiB |
|
116 Bytes |
2022-12-30 19:42:53 |
|
稻妻第一深情 (喝酒の吟游诗人)
|
5ms |
444 KiB |
|
1.1 KiB |
2023-1-9 0:33:20 |
|
zzzhhhooonnnggg
|
5ms |
432 KiB |
|
124 Bytes |
2023-3-19 18:16:02 |
|
六 (江智昕)
|
5ms |
412 KiB |
|
116 Bytes |
2022-12-30 19:42:50 |
|
叶雨昊 (yeyuhao22006)
|
5ms |
384 KiB |
|
116 Bytes |
2022-10-24 20:51:03 |
|
学神降临 (陈柯玮)
|
5ms |
6.7 MiB |
|
127 Bytes |
2023-9-15 21:05:30 |
|
张景豪
|
5ms |
7 MiB |
|
116 Bytes |
2023-6-29 20:55:31 |
|
tyx_9192596
|
5ms |
436 KiB |
|
109 Bytes |
2023-3-15 7:52:52 |
|
杨颂恩 (yangsongen)
|
5ms |
6.9 MiB |
C++11(O2) |
118 Bytes |
2024-8-22 21:32:06 |
|
六 (江智昕)
|
5ms |
384 KiB |
|
116 Bytes |
2022-12-30 19:42:56 |
|
叶雨昊 (yeyuhao22006)
|
5ms |
392 KiB |
|
116 Bytes |
2022-10-24 20:48:54 |
|
火星伞宾——刘晏恺 (刘晏恺)
|
5ms |
6.9 MiB |
|
161 Bytes |
2023-8-15 10:37:42 |
|
丛林 (conglin)
|
5ms |
440 KiB |
|
119 Bytes |
2022-12-2 21:35:49 |
|
jighghjkfkhfdhdfdfdsfsdfsafvmnkbnkbmnlvnmkbvnvb;,.m;,;.;,;kbvlmkbnlmkblnvkmlbnkmlbvkmlbvklmbkmlkblmbnm;,l.,.;,'.,';.[',;.[,kjkoihgfhfgiohifgohifgohiofgihgofhiofgihofgihofgihofgiho;''[;.',m;.',m.;',.;'m,.;';'cv;x'cb'cx;b'cv;b'xc;b'c;b'cvbvc.'bv.//,/vb./vcb./cvbv,c.b,cv.,b.cv,b.vc,bg;hgl;hgl;hg;h;hfg;hl;lf;l;lxc;cln;bvln;vcln;vnl;vbl;vbln;vlv;blnvb;plnp;lplhfljpjh;nlvb;nv;bn;vcvl;nlv;nlv;g;hjhchl;ghfghl;fghl;ltlh;l;hlf;lg;bnlc;;nlv;nbv;nbv;nvb;nlvcnl;xc;blxcb;ll;hg;lhgl;dfl;t;ldy;l;lyl;rewlt493;l;dl;dsflg;lsdlpbpcxobpocvbpopopopreopotpreotertertretert (litingxu)
|
5ms |
432 KiB |
|
115 Bytes |
2023-3-19 17:58:47 |
|
邓皓天 (1234567A)
|
5ms |
6.9 MiB |
|
139 Bytes |
2023-7-7 19:44:32 |
|
王祎辰 (wangyichen)
|
5ms |
384 KiB |
|
110 Bytes |
2022-10-7 15:45:17 |
|
六 (江智昕)
|
5ms |
384 KiB |
|
116 Bytes |
2022-12-30 19:42:55 |
|
RanHao
|
5ms |
7.3 MiB |
|
119 Bytes |
2023-7-20 14:53:18 |
|
tsc_ (杨悦堃)
|
5ms |
428 KiB |
|
136 Bytes |
2023-3-12 17:54:42 |
|
荣耀
|
5ms |
6.7 MiB |
|
108 Bytes |
2023-9-17 9:13:02 |
|
ReFly (NKZKY)
|
5ms |
6.9 MiB |
|
101 Bytes |
2023-11-27 19:56:50 |
|
余晨浩 (yuchenhao)
|
5ms |
440 KiB |
|
112 Bytes |
2022-8-24 15:23:24 |
|
刘洋
|
5ms |
6.7 MiB |
|
117 Bytes |
2023-9-15 20:43:37 |
|
新壹街-陈恺曦 (陈恺曦)
|
5ms |
6.9 MiB |
|
113 Bytes |
2023-11-24 20:00:59 |
|
何昊宇 (22016-hhy)
|
5ms |
6.9 MiB |
|
130 Bytes |
2023-8-8 13:29:34 |
|
坤坤荔枝小黑子 (zhonghaotian22006)
|
5ms |
444 KiB |
|
141 Bytes |
2023-2-12 17:18:13 |
|
凌胥桐1
|
5ms |
7 MiB |
C++98 |
136 Bytes |
2024-8-24 13:54:44 |
|
jky1
|
5ms |
432 KiB |
|
126 Bytes |
2023-3-19 15:33:35 |
|
878698786086868789780
|
5ms |
6.8 MiB |
|
138 Bytes |
2023-7-6 21:09:56 |
|
希蒙 (zhengxingya)
|
5ms |
6.9 MiB |
|
114 Bytes |
2023-7-19 18:46:42 |
|
hrz923
|
5ms |
6.9 MiB |
|
154 Bytes |
2023-8-4 20:59:29 |
|
坤坤荔枝小黑子 (zhonghaotian22006)
|
5ms |
416 KiB |
|
141 Bytes |
2022-9-6 20:27:24 |
|
Nico
|
5ms |
432 KiB |
|
113 Bytes |
2022-12-23 16:33:03 |
|
强愉堃 (强愉堃1)
|
5ms |
6.9 MiB |
|
138 Bytes |
2023-7-14 13:19:43 |
|
Error404sans (焦阳浩云)
|
5ms |
436 KiB |
|
109 Bytes |
2023-1-15 15:00:02 |
|
周靖松 (ZhouJS)
|
5ms |
6.8 MiB |
|
119 Bytes |
2023-6-27 22:28:48 |
|
王彬羽 (wby)
|
5ms |
7.4 MiB |
|
127 Bytes |
2023-6-24 11:13:22 |
|
叶雨昊 (yeyuhao22006)
|
5ms |
384 KiB |
|
116 Bytes |
2022-10-24 20:48:53 |
|
新壹街 朱启航 (zhuqihang)
|
5ms |
6.9 MiB |
|
108 Bytes |
2023-7-7 13:36:36 |
|
CPL
|
5ms |
432 KiB |
|
129 Bytes |
2023-2-16 19:59:28 |
|
朱老师 (zyp)
|
5ms |
436 KiB |
|
116 Bytes |
2022-7-18 13:18:30 |
|
龚铭俊 (哈哈哈)
|
5ms |
432 KiB |
|
121 Bytes |
2023-1-14 10:21:24 |
|
葛琮扬
|
5ms |
6.9 MiB |
|
373 Bytes |
2023-8-19 11:12:40 |
|
任凌薇
|
5ms |
6.9 MiB |
|
125 Bytes |
2023-7-13 10:35:48 |
|
新壹街陈科言 (cky)
|
5ms |
6.9 MiB |
|
271 Bytes |
2023-7-20 10:22:16 |
|
摩拉克斯
|
5ms |
7.2 MiB |
|
110 Bytes |
2023-7-6 18:44:10 |
|
王卓薪
|
5ms |
6.8 MiB |
|
144 Bytes |
2023-6-11 10:36:11 |
|
甄一阳 (22016-zyy)
|
5ms |
452 KiB |
|
128 Bytes |
2022-10-30 11:04:15 |
|
周琪渃
|
5ms |
440 KiB |
|
127 Bytes |
2022-12-9 20:12:20 |
|
张祖名
|
5ms |
6.9 MiB |
|
133 Bytes |
2023-7-7 19:49:50 |
|
新壹街校区-冉睦阳 (冉睦阳)
|
5ms |
512 KiB |
|
92 Bytes |
2023-5-28 15:20:10 |
|
马渝杭 (mayuhang)
|
5ms |
512 KiB |
|
109 Bytes |
2023-3-21 19:37:21 |
|
一片落叶 (yeyuhao)
|
5ms |
6.7 MiB |
|
103 Bytes |
2023-8-24 12:15:08 |
|
邵冠铖 (shaoguancheng22031)
|
5ms |
512 KiB |
|
110 Bytes |
2022-9-26 21:14:21 |
|
lichenrui23010
|
5ms |
6.7 MiB |
|
103 Bytes |
2023-8-24 10:51:27 |
|
UsMt1 (jiangyuan)
|
5ms |
7 MiB |
|
130 Bytes |
2023-7-20 16:22:06 |
|
新壹街校区-罗斤天 (罗斤天)
|
5ms |
6.8 MiB |
|
113 Bytes |
2023-7-9 8:24:55 |
|
廖海宇在追杀马牌痞 (liaohaiyu22031)
|
5ms |
440 KiB |
|
189 Bytes |
2023-3-10 20:11:30 |
|
李晨希
|
5ms |
7 MiB |
|
181 Bytes |
2023-7-19 9:44:23 |
|
wangyueru
|
5ms |
420 KiB |
|
112 Bytes |
2022-10-15 22:41:02 |
|
WJZ
|
5ms |
432 KiB |
|
99 Bytes |
2023-3-19 18:07:19 |
|
zhaoyinjie23005
|
5ms |
6.9 MiB |
|
114 Bytes |
2023-11-9 18:18:38 |
|
陈玺宇
|
5ms |
6.9 MiB |
|
113 Bytes |
2023-8-1 11:13:50 |
|
龙猫
|
5ms |
7.3 MiB |
|
116 Bytes |
2023-7-10 19:13:52 |
|
赵浚言
|
5ms |
6.5 MiB |
|
121 Bytes |
2023-11-17 17:56:22 |
|
Error404sans (焦阳浩云)
|
5ms |
384 KiB |
|
109 Bytes |
2023-1-15 15:00:13 |
|
张雯皓 (zhangwenhao)
|
5ms |
6.9 MiB |
|
107 Bytes |
2023-7-20 10:33:15 |
|
郑岐蔚
|
5ms |
440 KiB |
|
109 Bytes |
2023-1-26 13:43:56 |
|
zvt_132 (任子轩)
|
5ms |
6.9 MiB |
|
118 Bytes |
2023-7-13 14:18:46 |
|
许徐非凡 (非同凡响)
|
5ms |
7.9 MiB |
|
110 Bytes |
2023-7-20 19:37:30 |
|
chenxiaozhun
|
5ms |
416 KiB |
|
129 Bytes |
2022-9-30 19:18:03 |
|
新壹街罗田雨 (罗田雨29)
|
5ms |
6.9 MiB |
|
117 Bytes |
2023-8-2 20:47:15 |
|
diaozhengyang
|
5ms |
6.9 MiB |
|
122 Bytes |
2023-8-10 10:39:46 |
|
爱琴海校区-刁钲洋 (刁钲洋)
|
5ms |
432 KiB |
|
113 Bytes |
2023-1-11 21:04:00 |
|
龙吉先 (ljx)
|
5ms |
6.8 MiB |
|
159 Bytes |
2023-7-19 9:00:58 |
|
南坪校区-龙浩睿 (longhaorui)
|
5ms |
7 MiB |
|
121 Bytes |
2023-12-31 15:51:33 |
|
德克萨斯做的到吗 (liyangbao)
|
5ms |
436 KiB |
|
187 Bytes |
2022-10-24 17:23:38 |
|
叶雨昊 (yeyuhao22006)
|
5ms |
436 KiB |
|
116 Bytes |
2023-1-7 17:13:01 |
|
yanglang
|
5ms |
384 KiB |
|
119 Bytes |
2022-10-15 19:48:03 |
|
李睿杰
|
5ms |
424 KiB |
|
101 Bytes |
2022-9-2 22:39:50 |
|
duanxinghe
|
5ms |
8 MiB |
|
113 Bytes |
2023-8-21 10:44:15 |
|
益布响完辣 (黄靖益1)
|
5ms |
7.1 MiB |
|
121 Bytes |
2023-7-7 15:04:45 |
|
叶雨昊 (yeyuhao22006)
|
6ms |
492 KiB |
|
116 Bytes |
2022-10-24 20:49:00 |
|
杨皓宇 (杨浩宇)
|
6ms |
512 KiB |
|
150 Bytes |
2022-8-23 18:00:33 |
|
罗竣瀚
|
6ms |
440 KiB |
|
104 Bytes |
2022-10-13 22:05:48 |