|
shenyushun1
|
8ms |
308 KiB |
|
424 Bytes |
2022-9-10 17:45:49 |
|
时代2校-程俊燃 (chengjunran)
|
9ms |
7 MiB |
|
365 Bytes |
2024-1-1 15:03:42 |
|
zyl
|
11ms |
7 MiB |
|
329 Bytes |
2023-12-28 16:08:22 |
|
手搓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)
|
11ms |
7.4 MiB |
|
479 Bytes |
2023-11-12 10:31:57 |
|
Tender. (05c05-zhou)
|
11ms |
384 KiB |
|
301 Bytes |
2023-2-19 18:46:07 |
|
zcx
|
12ms |
7.5 MiB |
|
302 Bytes |
2023-11-12 10:11:50 |
|
xmw318046
|
12ms |
6.6 MiB |
C++98 |
386 Bytes |
2024-7-6 18:34:09 |
|
汤杰尧 (05c05-tjy1)
|
13ms |
428 KiB |
|
369 Bytes |
2023-2-19 18:46:47 |
|
姚宏逸
|
13ms |
412 KiB |
|
400 Bytes |
2022-3-27 23:53:02 |
|
05c05-yyc
|
13ms |
384 KiB |
|
256 Bytes |
2023-2-19 18:41:25 |
|
叶雨昊 (yeyuhao22006)
|
13ms |
384 KiB |
|
247 Bytes |
2023-2-19 18:40:52 |
|
张峻瑞
|
13ms |
512 KiB |
|
296 Bytes |
2022-9-13 20:35:52 |
|
文硕 (文硕1)
|
13ms |
384 KiB |
|
485 Bytes |
2022-7-12 11:57:37 |
|
芒苒忧 (廖迦南)
|
13ms |
436 KiB |
|
327 Bytes |
2022-8-3 15:15:38 |
|
姜宇辰
|
13ms |
396 KiB |
|
370 Bytes |
2022-2-12 11:50:08 |
|
坤坤荔枝小黑子 (zhonghaotian22006)
|
13ms |
392 KiB |
|
273 Bytes |
2023-2-19 18:38:02 |
|
赵泳鑫 (zhaoyongxin)
|
13ms |
436 KiB |
|
485 Bytes |
2022-4-23 17:59:57 |
|
1396013295
|
13ms |
384 KiB |
|
490 Bytes |
2022-1-23 17:44:00 |
|
hzm
|
13ms |
384 KiB |
|
439 Bytes |
2022-9-13 20:38:30 |
|
の (魏子恒)
|
13ms |
420 KiB |
|
316 Bytes |
2022-9-13 20:54:19 |
|
坤坤荔枝小黑子 (zhonghaotian22006)
|
13ms |
392 KiB |
|
382 Bytes |
2022-11-15 11:16:42 |
|
偽艺術家 (chenyanchi22006)
|
13ms |
384 KiB |
|
282 Bytes |
2023-2-19 18:46:05 |
|
Yuan (Zongzi1)
|
13ms |
6.5 MiB |
C++17(O2) |
559 Bytes |
2024-7-21 18:41:44 |
|
杨坤霖 (steven)
|
13ms |
392 KiB |
|
435 Bytes |
2023-2-4 13:41:41 |
|
杜俊宏
|
13ms |
444 KiB |
|
512 Bytes |
2022-9-10 18:15:12 |
|
ycy
|
13ms |
384 KiB |
|
467 Bytes |
2022-9-8 14:46:00 |
|
刘老师 (图书管理员)
|
13ms |
384 KiB |
|
389 Bytes |
2022-2-12 11:59:18 |
|
叶雨昊 (yeyuhao22006)
|
13ms |
384 KiB |
|
247 Bytes |
2023-2-19 18:40:15 |
|
wangzihang
|
13ms |
6.4 MiB |
C++98 |
779 Bytes |
2024-7-5 14:18:28 |
|
周琪渃
|
13ms |
6.9 MiB |
|
391 Bytes |
2023-7-27 14:13:09 |
|
叶雨昊 (yeyuhao22006)
|
14ms |
392 KiB |
|
247 Bytes |
2023-2-19 18:40:52 |
|
张梓辰 (DiaoDesi屌德斯)
|
14ms |
384 KiB |
|
352 Bytes |
2022-9-13 20:47:26 |
|
无尽的想象 (谭仕高)
|
14ms |
6.8 MiB |
|
463 Bytes |
2023-10-9 20:44:06 |
|
hanminyu
|
14ms |
436 KiB |
|
415 Bytes |
2023-1-31 9:40:08 |
|
经常消失 (小萝卜)
|
14ms |
428 KiB |
|
365 Bytes |
2023-2-1 11:10:14 |
|
wangruibo20xh
|
14ms |
448 KiB |
|
273 Bytes |
2022-2-11 19:15:53 |
|
我是个s* (lijinze)
|
14ms |
384 KiB |
|
386 Bytes |
2023-3-24 21:11:28 |
|
SYC0226
|
14ms |
440 KiB |
|
554 Bytes |
2022-4-10 10:45:29 |
|
拥抱幸福小熊(吴沛篪)
|
14ms |
7.1 MiB |
C++98 |
368 Bytes |
2024-4-25 16:16:01 |
|
朱老师 (zyp)
|
14ms |
428 KiB |
|
340 Bytes |
2022-8-18 18:15:59 |
|
啊...这 (炼狱杏寿郎)
|
14ms |
512 KiB |
|
515 Bytes |
2022-8-10 16:22:52 |
|
10255
|
14ms |
400 KiB |
|
353 Bytes |
2023-3-24 21:05:43 |
|
hyh22031
|
14ms |
7 MiB |
|
327 Bytes |
2023-11-12 9:46:05 |
|
胡澜之 (666hlz666)
|
14ms |
384 KiB |
|
575 Bytes |
2023-5-25 18:30:52 |
|
陈杰晟
|
14ms |
444 KiB |
|
306 Bytes |
2022-2-22 13:29:16 |
|
新壹街校区-陈琬舒 (空空大师)
|
14ms |
6.7 MiB |
|
442 Bytes |
2023-9-9 11:46:04 |
|
李倾城的忠实假粉 (向熠可)
|
14ms |
444 KiB |
|
345 Bytes |
2022-3-27 14:37:02 |
|
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)
|
14ms |
6.8 MiB |
|
617 Bytes |
2023-8-24 15:38:39 |
|
马渝杭 (mayuhang)
|
14ms |
392 KiB |
|
507 Bytes |
2023-3-24 21:03:13 |
|
胡宸华 (huchenhua)
|
14ms |
6.9 MiB |
|
386 Bytes |
2023-8-20 22:35:30 |
|
疯神芭芭脱丝 (李卓修)
|
14ms |
436 KiB |
|
462 Bytes |
2022-7-12 11:49:52 |
|
周琪渃
|
14ms |
6.9 MiB |
|
392 Bytes |
2023-7-27 14:16:27 |
|
偽艺術家 (chenyanchi22006)
|
14ms |
392 KiB |
|
282 Bytes |
2023-2-19 18:46:05 |
|
源著校区-宋昊成 (马冬梅)
|
14ms |
428 KiB |
|
578 Bytes |
2023-2-26 19:39:03 |
|
肖添宇
|
14ms |
512 KiB |
|
485 Bytes |
2022-4-16 20:14:25 |
|
谭懿轩 (yanyixuan)
|
14ms |
384 KiB |
|
353 Bytes |
2022-8-24 15:18:19 |
|
啊...这 (炼狱杏寿郎)
|
14ms |
384 KiB |
|
519 Bytes |
2022-8-10 15:50:34 |
|
zlx (xiao)
|
15ms |
512 KiB |
|
658 Bytes |
2022-11-26 18:45:53 |
|
scallway
|
15ms |
6.8 MiB |
|
386 Bytes |
2023-6-24 14:50:14 |
|
欧俊阳
|
15ms |
6.9 MiB |
|
377 Bytes |
2023-8-10 12:13:53 |
|
李林峰 (金克拉)
|
15ms |
444 KiB |
|
442 Bytes |
2022-9-13 20:34:01 |
|
贺睿林
|
15ms |
6.7 MiB |
|
267 Bytes |
2023-9-30 10:57:30 |
|
zhangheyi22006
|
15ms |
392 KiB |
|
321 Bytes |
2023-2-19 18:47:11 |
|
时代二校-焦雨齐 (Angel)
|
15ms |
7.1 MiB |
|
695 Bytes |
2023-7-16 16:14:09 |
|
李树崑 (lishukun)
|
15ms |
392 KiB |
|
412 Bytes |
2022-11-5 15:26:29 |
|
scallway
|
15ms |
6.8 MiB |
|
386 Bytes |
2023-6-16 13:15:46 |
|
时代校区-刘臣原 (微笑王子)
|
15ms |
436 KiB |
|
582 Bytes |
2022-9-13 19:40:02 |
|
新壹街校区-周士杰 (zsj)
|
15ms |
6.8 MiB |
|
471 Bytes |
2023-9-16 20:54:06 |
|
RanHao
|
15ms |
6.9 MiB |
|
353 Bytes |
2023-8-2 10:08:20 |
|
欧俊阳
|
15ms |
6.9 MiB |
|
372 Bytes |
2023-8-10 12:14:26 |
|
scallway
|
15ms |
7 MiB |
|
386 Bytes |
2023-6-17 17:34:41 |
|
爱琴海校区-刁钲洋 (刁钲洋)
|
15ms |
7 MiB |
|
449 Bytes |
2023-7-9 8:50:39 |
|
11451254188 (22029-mjh)
|
15ms |
7 MiB |
|
328 Bytes |
2023-11-12 10:32:23 |
|
林凡童 (lft)
|
15ms |
440 KiB |
|
509 Bytes |
2022-9-15 19:49:48 |
|
scallway
|
15ms |
6.8 MiB |
|
426 Bytes |
2023-6-16 13:08:20 |
|
任童(rentong)
|
15ms |
512 KiB |
|
591 Bytes |
2023-2-3 17:31:23 |
|
我是周靖松长得帅 (mouyunqi)
|
16ms |
440 KiB |
|
384 Bytes |
2023-3-24 20:59:30 |
|
zhm123
|
16ms |
384 KiB |
|
457 Bytes |
2022-10-28 17:13:40 |
|
huanglu
|
16ms |
6.7 MiB |
|
528 Bytes |
2023-9-14 20:02:07 |
|
RanHao
|
16ms |
6.7 MiB |
|
277 Bytes |
2023-9-16 11:47:15 |
|
赵沛喆
|
16ms |
512 KiB |
|
333 Bytes |
2022-11-20 9:53:09 |
|
新壹街校区-罗斤天 (罗斤天)
|
16ms |
6.9 MiB |
|
471 Bytes |
2023-7-9 8:32:47 |
|
jdy
|
16ms |
436 KiB |
|
670 Bytes |
2023-3-17 20:42:05 |
|
guozuming
|
16ms |
440 KiB |
|
276 Bytes |
2023-1-25 21:57:42 |
|
zhouxifei
|
17ms |
428 KiB |
|
287 Bytes |
2022-10-17 20:10:54 |
|
qinyi
|
17ms |
436 KiB |
|
301 Bytes |
2022-12-10 19:19:19 |
|
时代二校-王盼兮 (wangpanxi)
|
19ms |
7.2 MiB |
|
370 Bytes |
2023-12-24 11:07:57 |
|
欧俊阳
|
19ms |
6.9 MiB |
|
472 Bytes |
2023-8-10 12:09:10 |
|
廖海宇在追杀马牌痞 (liaohaiyu22031)
|
20ms |
7 MiB |
|
531 Bytes |
2023-11-12 9:12:42 |
|
zzzrrrxxx
|
25ms |
7 MiB |
|
420 Bytes |
2023-12-17 16:34:58 |
|
秦兴润
|
27ms |
7.2 MiB |
|
353 Bytes |
2023-12-24 11:12:44 |
|
wangjun
|
27ms |
7.2 MiB |
|
342 Bytes |
2023-11-30 12:51:45 |
|
My name is Man (钟卓劭)
|
66ms |
536 KiB |
|
562 Bytes |
2024-3-31 10:16:08 |
|
赵奕铭
|
67ms |
544 KiB |
|
500 Bytes |
2024-3-12 21:58:56 |
|
张梓浩 (zhangzihao)
|
67ms |
764 KiB |
|
330 Bytes |
2024-3-24 10:52:44 |
|
孙烽轶 (sfy)
|
69ms |
532 KiB |
|
475 Bytes |
2024-4-1 20:15:52 |
|
ysf.wlanwq.ZJSWL 1922~1991 (韦舒豪)
|
72ms |
532 KiB |
|
302 Bytes |
2024-4-13 15:15:11 |
|
Jose (反恐皮蛋)
|
111ms |
9.3 MiB |
Python 3 |
160 Bytes |
2024-7-28 16:26:59 |
|
伍行念 (wuxingnian)
|
191ms |
8.9 MiB |
Python 3 |
146 Bytes |
2023-10-27 15:44:55 |
|
梨冻亿 (wiueh)
|
195ms |
3.9 MiB |
Python 3 |
196 Bytes |
2022-1-23 18:48:29 |