|
中岛敦 (黄麒瑞)
|
29ms |
6.7 MiB |
|
232 Bytes |
2023-9-30 21:35:32 |
|
宋金龙 (songjl0421)
|
29ms |
384 KiB |
|
198 Bytes |
2022-1-22 18:14:01 |
|
高国瑞
|
29ms |
6.9 MiB |
|
202 Bytes |
2023-7-17 19:10:27 |
|
22029-hqh
|
29ms |
512 KiB |
|
155 Bytes |
2022-10-31 21:24:34 |
|
手搓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)
|
29ms |
392 KiB |
|
195 Bytes |
2022-11-5 11:30:41 |
|
hnd (陈皓洋)
|
29ms |
384 KiB |
|
166 Bytes |
2022-11-16 21:20:45 |
|
wuqilin
|
29ms |
384 KiB |
|
235 Bytes |
2023-2-5 15:11:49 |
|
^_^ (ctc)
|
29ms |
412 KiB |
|
184 Bytes |
2022-10-11 20:50:35 |
|
黄梓轩 (huangzixuan)
|
29ms |
6.9 MiB |
|
192 Bytes |
2023-7-16 14:15:35 |
|
罗伟杰 (13308275065)
|
29ms |
392 KiB |
|
203 Bytes |
2022-12-8 19:55:41 |
|
钟睿煊 (zhongruixuan)
|
29ms |
6.8 MiB |
|
152 Bytes |
2023-7-16 14:02:49 |
|
kkksc03 (彭士锋)
|
29ms |
448 KiB |
|
222 Bytes |
2022-3-11 19:00:20 |
|
杜是贤 (dushixian)
|
29ms |
512 KiB |
|
170 Bytes |
2022-7-17 14:42:22 |
|
Jack
|
29ms |
384 KiB |
|
174 Bytes |
2022-9-2 20:04:07 |
|
星野 光 (Hoshino Hikari)
|
29ms |
6.8 MiB |
|
242 Bytes |
2023-10-22 23:06:59 |
|
甄一阳 (22016-zyy)
|
29ms |
6.8 MiB |
|
192 Bytes |
2023-6-10 18:03:57 |
|
zzzrrrxxx
|
29ms |
6.9 MiB |
|
152 Bytes |
2023-7-16 14:13:05 |
|
yanglang
|
29ms |
384 KiB |
|
170 Bytes |
2022-10-22 16:29:30 |
|
刘昊臻 (liuhaozhen)
|
29ms |
440 KiB |
|
233 Bytes |
2023-5-17 20:05:26 |
|
时代一校-曾科智 (曾科智)
|
29ms |
512 KiB |
|
157 Bytes |
2023-2-25 19:44:06 |
|
贾鑫豪 (Mr Sam)
|
29ms |
512 KiB |
|
169 Bytes |
2022-3-3 6:44:47 |
|
juyuxuan
|
29ms |
7 MiB |
|
181 Bytes |
2023-11-18 10:36:06 |
|
王晴萱
|
29ms |
7.6 MiB |
|
205 Bytes |
2023-7-13 16:26:39 |
|
马渝杭 (mayuhang)
|
29ms |
440 KiB |
|
172 Bytes |
2022-8-22 12:24:09 |
|
在煎鱼的肖大总铳 (肖宇航)
|
29ms |
7 MiB |
|
180 Bytes |
2023-9-24 11:06:15 |
|
重庆新壹街-钟政鑫 (钟政鑫)
|
30ms |
6.9 MiB |
|
194 Bytes |
2023-10-28 14:24:36 |
|
UsMt1 (jiangyuan)
|
30ms |
6.9 MiB |
|
221 Bytes |
2023-7-28 9:53:20 |
|
CK (李弘毅)
|
30ms |
6.7 MiB |
|
223 Bytes |
2023-8-24 14:08:15 |
|
xzf
|
30ms |
6.7 MiB |
|
212 Bytes |
2023-9-10 15:27:31 |
|
dengfeng
|
30ms |
512 KiB |
|
178 Bytes |
2022-12-29 10:35:35 |
|
时代1校-杨宇轩 (杨宇轩)
|
30ms |
6.7 MiB |
|
180 Bytes |
2023-8-31 17:23:13 |
|
源著校区-宋昊成 (马冬梅)
|
30ms |
512 KiB |
|
235 Bytes |
2023-2-25 18:10:56 |
|
三差学生 (尘埃蓝莓)
|
30ms |
6.9 MiB |
|
150 Bytes |
2023-10-28 18:45:55 |
|
22029-zjs
|
30ms |
396 KiB |
|
205 Bytes |
2022-11-5 12:12:28 |
|
希蒙 (zhengxingya)
|
30ms |
7 MiB |
|
265 Bytes |
2023-8-21 11:09:58 |
|
chenjunyao
|
30ms |
6.9 MiB |
|
245 Bytes |
2023-8-20 17:24:19 |
|
游智棋
|
30ms |
7.1 MiB |
|
230 Bytes |
2023-7-18 11:43:41 |
|
wangxingyue
|
30ms |
444 KiB |
|
154 Bytes |
2023-3-28 18:55:54 |
|
周 子 涵
|
30ms |
384 KiB |
|
180 Bytes |
2022-10-1 15:16:24 |
|
呵呵呵 (陈思琦)
|
30ms |
7 MiB |
|
154 Bytes |
2023-8-20 20:15:59 |
|
新壹街陈科言 (cky)
|
30ms |
444 KiB |
|
227 Bytes |
2023-5-12 19:33:15 |
|
伍芷函
|
30ms |
392 KiB |
|
232 Bytes |
2023-4-16 11:53:40 |
|
ddz
|
30ms |
512 KiB |
|
226 Bytes |
2022-3-6 18:31:00 |
|
22029-lsl
|
30ms |
444 KiB |
|
174 Bytes |
2022-11-5 11:06:16 |
|
zzl
|
30ms |
6.8 MiB |
|
242 Bytes |
2023-11-7 0:27:04 |
|
贾博涵
|
30ms |
6.8 MiB |
|
184 Bytes |
2023-11-8 11:46:23 |
|
新壹街校区-周士杰 (zsj)
|
30ms |
6.7 MiB |
|
173 Bytes |
2023-8-28 9:13:22 |
|
一片落叶 (yeyuhao)
|
30ms |
6.7 MiB |
|
166 Bytes |
2023-8-28 20:21:11 |
|
老六(王牌) (mhc)
|
30ms |
520 KiB |
|
182 Bytes |
2023-3-26 13:06:32 |
|
我很6 (zjj22031)
|
30ms |
392 KiB |
|
207 Bytes |
2023-3-19 9:53:07 |
|
熊海阳 (xiongxaiyang)
|
30ms |
6.9 MiB |
|
216 Bytes |
2023-8-13 9:05:08 |
|
火星伞宾——刘晏恺 (刘晏恺)
|
30ms |
6.9 MiB |
|
213 Bytes |
2023-8-15 11:18:40 |
|
时代2校-程俊燃 (chengjunran)
|
30ms |
6.9 MiB |
|
165 Bytes |
2023-8-20 22:15:28 |
|
时代一校-赵彦博 (zyb)
|
30ms |
6.9 MiB |
|
206 Bytes |
2023-8-3 14:49:06 |
|
张雯皓 (zhangwenhao)
|
31ms |
6.9 MiB |
|
208 Bytes |
2023-7-15 8:46:36 |
|
yanxiaosong
|
31ms |
384 KiB |
|
179 Bytes |
2022-11-5 14:14:16 |
|
罗翌珂 (dangdang)
|
31ms |
512 KiB |
|
208 Bytes |
2022-9-1 15:34:23 |
|
关博源
|
31ms |
512 KiB |
|
194 Bytes |
2023-2-24 18:32:46 |
|
yyds (杨骐嘉)
|
31ms |
7.2 MiB |
|
178 Bytes |
2023-12-28 20:08:21 |
|
黄彦熹 (AK-203)
|
31ms |
512 KiB |
|
198 Bytes |
2022-10-26 12:01:30 |
|
欧俊阳
|
31ms |
6.7 MiB |
|
193 Bytes |
2023-8-22 15:33:53 |
|
谁陪訫牞 (杀手) (22029-zys)
|
31ms |
440 KiB |
|
174 Bytes |
2022-11-1 20:40:05 |
|
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)
|
31ms |
392 KiB |
|
162 Bytes |
2023-3-26 18:01:53 |
|
huanglu
|
31ms |
7.1 MiB |
|
176 Bytes |
2023-7-15 16:16:47 |
|
小忙果 (王昱杰)
|
31ms |
500 KiB |
|
191 Bytes |
2023-3-22 20:58:44 |
|
龙湖时代C馆-邹镇宇 (邹镇宇)
|
31ms |
384 KiB |
|
188 Bytes |
2022-8-22 15:04:58 |
|
邹曜丞 (13983097018)
|
31ms |
6.9 MiB |
|
201 Bytes |
2023-7-18 11:28:46 |
|
张祖名
|
31ms |
6.7 MiB |
|
172 Bytes |
2023-9-5 19:41:24 |
|
wuqi
|
31ms |
6.9 MiB |
|
232 Bytes |
2023-7-23 13:30:31 |
|
tsc_ (杨悦堃)
|
31ms |
444 KiB |
|
174 Bytes |
2023-3-12 19:08:22 |
|
叶哲宇 (yzy)
|
32ms |
6.8 MiB |
|
171 Bytes |
2023-6-24 14:03:35 |
|
sb (吴振宇)
|
32ms |
6.9 MiB |
|
190 Bytes |
2023-7-27 13:31:54 |
|
wzzjnb2012
|
32ms |
392 KiB |
|
232 Bytes |
2022-9-29 21:59:44 |
|
AI创客
|
32ms |
6.5 MiB |
|
205 Bytes |
2023-11-16 21:59:09 |
|
牟淳雅
|
32ms |
6.9 MiB |
|
199 Bytes |
2023-7-26 13:23:25 |
|
王锦锐 (wjr)
|
32ms |
6.9 MiB |
|
202 Bytes |
2023-7-9 19:12:59 |
|
靳博然 (jbr)
|
32ms |
432 KiB |
|
204 Bytes |
2023-3-19 18:21:35 |
|
我推的乱破 (贺俊楠)
|
32ms |
6.8 MiB |
|
232 Bytes |
2023-6-29 13:45:00 |
|
廖海宇在追杀马牌痞 (liaohaiyu22031)
|
32ms |
512 KiB |
|
240 Bytes |
2023-1-8 12:57:00 |
|
yxj
|
32ms |
512 KiB |
|
179 Bytes |
2022-10-20 15:56:04 |
|
余晨浩 (yuchenhao)
|
32ms |
6.9 MiB |
|
178 Bytes |
2023-8-21 11:19:43 |
|
wrz
|
32ms |
7 MiB |
|
210 Bytes |
2023-12-24 12:43:12 |
|
Turorany (郑浩然)
|
32ms |
7.5 MiB |
|
182 Bytes |
2023-7-10 18:54:54 |
|
xflt_dyp
|
32ms |
6.9 MiB |
|
215 Bytes |
2023-7-22 16:41:06 |
|
刘致言
|
32ms |
512 KiB |
|
185 Bytes |
2023-3-11 9:28:25 |
|
RanHao
|
32ms |
6.9 MiB |
|
215 Bytes |
2023-7-22 10:58:31 |
|
Tender. (05c05-zhou)
|
33ms |
512 KiB |
|
166 Bytes |
2022-10-17 20:37:59 |
|
xuniaoyin (徐袅音)
|
33ms |
7.3 MiB |
|
197 Bytes |
2023-7-14 10:13:42 |
|
杨坤霖 (steven)
|
33ms |
512 KiB |
|
176 Bytes |
2023-1-14 10:04:54 |
|
稻妻第一深情 (喝酒の吟游诗人)
|
33ms |
512 KiB |
|
1.3 KiB |
2023-1-11 15:36:26 |
|
刘政君 (lzj)
|
33ms |
512 KiB |
|
172 Bytes |
2022-12-24 23:01:23 |
|
时代二校-陈天成 (鸭缩毛巾)
|
33ms |
6.9 MiB |
|
174 Bytes |
2023-7-31 22:51:23 |
|
执剑人罗辑 (Jasson)
|
34ms |
444 KiB |
|
198 Bytes |
2023-1-20 12:21:26 |
|
(张洛诚)
|
34ms |
520 KiB |
|
202 Bytes |
2023-4-18 19:50:23 |
|
谁陪訫牞 (杀手) (22029-zys)
|
34ms |
512 KiB |
|
141 Bytes |
2023-1-5 16:23:44 |
|
zyl
|
34ms |
7 MiB |
|
221 Bytes |
2024-1-3 17:39:31 |
|
罗莎莎
|
35ms |
6.9 MiB |
|
171 Bytes |
2023-7-20 15:28:48 |
|
龙吉先 (ljx)
|
35ms |
7 MiB |
|
202 Bytes |
2023-11-11 15:42:59 |
|
胡澜之 (666hlz666)
|
35ms |
7.1 MiB |
|
152 Bytes |
2023-7-7 19:22:40 |
|
向俊熙 (xiangjunxi23003)
|
35ms |
6.9 MiB |
|
188 Bytes |
2023-8-4 15:47:00 |