|
赵泳鑫 (zhaoyongxin)
|
7ms |
436 KiB |
|
373 Bytes |
2022-4-16 17:58:19 |
|
文硕 (文硕1)
|
8ms |
428 KiB |
|
348 Bytes |
2022-2-6 14:08:54 |
|
李山水
|
9ms |
436 KiB |
|
487 Bytes |
2022-2-16 17:27:06 |
|
wangjun
|
13ms |
7.2 MiB |
|
421 Bytes |
2023-12-1 11:18:35 |
|
zhm123
|
13ms |
6.5 MiB |
|
401 Bytes |
2023-11-17 15:19:50 |
|
xmw318046
|
13ms |
6.7 MiB |
C++98 |
420 Bytes |
2024-7-4 17:49:08 |
|
邵冠铖 (shaoguancheng22031)
|
13ms |
384 KiB |
|
365 Bytes |
2023-2-19 12:27:17 |
|
11451254188 (22029-mjh)
|
13ms |
384 KiB |
|
478 Bytes |
2023-2-16 21:11:42 |
|
龙湖源著校区 郑皓铭 (郑皓铭)
|
14ms |
384 KiB |
|
468 Bytes |
2023-5-7 18:59:58 |
|
张瑞博
|
14ms |
6.7 MiB |
C++11 |
357 Bytes |
2024-7-13 14:16:09 |
|
1396013295
|
14ms |
384 KiB |
|
568 Bytes |
2022-1-23 20:11:59 |
|
Yuan (Zongzi1)
|
14ms |
6.5 MiB |
C++17(O2) |
498 Bytes |
2024-7-21 18:09:34 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
14ms |
448 KiB |
|
372 Bytes |
2023-2-23 20:28:23 |
|
杜是贤 (dushixian)
|
14ms |
512 KiB |
|
387 Bytes |
2022-6-19 11:23:12 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
14ms |
392 KiB |
|
372 Bytes |
2023-2-23 20:28:16 |
|
赵沛喆
|
14ms |
552 KiB |
|
435 Bytes |
2022-7-24 16:12:01 |
|
Erin
|
14ms |
6.9 MiB |
C++98 |
369 Bytes |
2024-6-11 14:26:18 |
|
张瑞博
|
14ms |
6.6 MiB |
C++11 |
355 Bytes |
2024-7-28 13:18: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)
|
14ms |
384 KiB |
|
534 Bytes |
2023-2-18 11:33:51 |
|
12345
|
15ms |
512 KiB |
|
504 Bytes |
2022-3-22 19:56:11 |
|
杜俊宏
|
15ms |
384 KiB |
|
489 Bytes |
2022-10-22 17:41:43 |
|
经常消失 (小萝卜)
|
15ms |
512 KiB |
|
504 Bytes |
2022-3-23 19:34:56 |
|
xiangsiyu
|
15ms |
412 KiB |
|
373 Bytes |
2022-8-5 11:13:55 |
|
dengduxi
|
15ms |
640 KiB |
|
504 Bytes |
2022-12-5 20:28:20 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
15ms |
384 KiB |
|
372 Bytes |
2023-2-23 20:28:38 |
|
朱老师 (zyp)
|
15ms |
448 KiB |
|
473 Bytes |
2022-8-15 16:32:24 |
|
22029-lyh
|
15ms |
392 KiB |
|
534 Bytes |
2023-2-19 12:22:46 |
|
56 (13883454928)
|
15ms |
512 KiB |
|
382 Bytes |
2022-2-26 18:50:50 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
15ms |
384 KiB |
|
372 Bytes |
2023-2-23 20:28:22 |
|
梨冻亿 (wiueh)
|
15ms |
384 KiB |
|
549 Bytes |
2022-1-23 18:36:15 |
|
李倾城的忠实假粉 (向熠可)
|
15ms |
512 KiB |
|
346 Bytes |
2022-3-26 11:07:11 |
|
Jack
|
15ms |
384 KiB |
|
520 Bytes |
2023-5-24 18:21:11 |
|
12345
|
15ms |
512 KiB |
|
545 Bytes |
2022-3-19 15:27:15 |
|
张祖名
|
15ms |
7 MiB |
C++98(O2) |
484 Bytes |
2024-6-19 21:48:10 |
|
赵一嵘 (zhaoyirong)
|
15ms |
564 KiB |
|
545 Bytes |
2022-6-18 13:50:21 |
|
12345
|
15ms |
512 KiB |
|
504 Bytes |
2022-3-22 19:39:09 |
|
zcx
|
15ms |
512 KiB |
|
465 Bytes |
2023-2-17 19:57:34 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
15ms |
392 KiB |
|
372 Bytes |
2023-2-23 20:28:37 |
|
刘政君 (lzj)
|
15ms |
384 KiB |
|
458 Bytes |
2022-8-31 13:12:15 |
|
陈杰晟
|
15ms |
520 KiB |
|
460 Bytes |
2022-2-26 18:49:27 |
|
杜启苇 (duqiwei)
|
15ms |
544 KiB |
|
377 Bytes |
2022-7-23 14:16:57 |
|
没有此人 (akm)
|
15ms |
512 KiB |
|
522 Bytes |
2023-2-2 17:01:52 |
|
SYC0226
|
15ms |
384 KiB |
|
434 Bytes |
2022-3-20 14:22:12 |
|
12345
|
15ms |
512 KiB |
|
504 Bytes |
2022-3-22 19:56:07 |
|
徐正旺 (xzw)
|
15ms |
512 KiB |
|
390 Bytes |
2022-2-26 18:57:11 |
|
王科睿 (鲨凋的小鲨鱼)
|
15ms |
512 KiB |
|
504 Bytes |
2022-2-26 18:56:05 |
|
张泰凌 (ztl)
|
15ms |
512 KiB |
|
545 Bytes |
2022-3-19 13:29:18 |
|
qinyi
|
15ms |
384 KiB |
|
423 Bytes |
2022-2-26 18:40:18 |
|
许炜铭 (xuweiming)
|
15ms |
7.1 MiB |
|
393 Bytes |
2023-7-13 11:35:00 |
|
秦子越 (13883322087)
|
15ms |
512 KiB |
|
390 Bytes |
2022-2-26 18:57:29 |
|
05c05-scl
|
15ms |
512 KiB |
|
446 Bytes |
2023-2-17 21:15:21 |
|
wcy
|
15ms |
512 KiB |
|
545 Bytes |
2022-2-26 18:57:17 |
|
黄梓桐 (HuangZiTong)
|
15ms |
548 KiB |
|
545 Bytes |
2023-2-2 13:35:34 |
|
许嘉恩 (xje22031)
|
15ms |
512 KiB |
|
398 Bytes |
2023-2-23 20:25:43 |
|
鲜榨大肠汁
|
15ms |
512 KiB |
|
381 Bytes |
2022-2-26 18:51:01 |
|
wangxingyue
|
15ms |
512 KiB |
|
375 Bytes |
2022-2-26 18:56:58 |
|
源著校区-宋昊成 (马冬梅)
|
15ms |
440 KiB |
|
605 Bytes |
2023-2-26 19:36:07 |
|
我和赵梓晴之间不是一般的亲密 (fengyuanzheng)
|
15ms |
512 KiB |
|
545 Bytes |
2022-2-26 18:54:58 |
|
姚宏逸
|
15ms |
560 KiB |
|
545 Bytes |
2022-4-11 20:33:30 |
|
任童(rentong)
|
16ms |
568 KiB |
|
512 Bytes |
2023-2-3 16:18:13 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
16ms |
384 KiB |
|
372 Bytes |
2023-2-23 20:28:13 |
|
廖海宇在追杀马牌痞 (liaohaiyu22031)
|
16ms |
6.8 MiB |
C++98 |
377 Bytes |
2024-8-7 9:10:22 |
|
zcszcs
|
16ms |
6.7 MiB |
|
417 Bytes |
2023-9-23 17:21:47 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
16ms |
384 KiB |
|
372 Bytes |
2023-2-23 20:28:35 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
16ms |
384 KiB |
|
372 Bytes |
2023-2-23 20:28:36 |
|
游智棋
|
16ms |
536 KiB |
|
522 Bytes |
2022-10-16 9:36:34 |
|
汪致卉 (wangzh)
|
16ms |
436 KiB |
|
580 Bytes |
2022-4-22 16:25:34 |
|
陈泰羽 (chentaiyu)
|
16ms |
412 KiB |
|
391 Bytes |
2023-3-31 21:01:54 |
|
xuniaoyin (徐袅音)
|
16ms |
6.8 MiB |
|
454 Bytes |
2023-10-7 21:43:56 |
|
程子杰 (05c41-czj)
|
16ms |
476 KiB |
|
508 Bytes |
2022-7-27 17:02:44 |
|
error_sans
|
16ms |
512 KiB |
|
359 Bytes |
2022-2-26 18:51:59 |
|
wangzihang
|
16ms |
7.1 MiB |
|
393 Bytes |
2023-12-18 16:36:43 |
|
kkksc03 (彭士锋)
|
16ms |
512 KiB |
|
408 Bytes |
2022-3-12 13:30:39 |
|
22029-zjs
|
16ms |
384 KiB |
|
454 Bytes |
2023-2-16 19:53:02 |
|
lch (凌昌瀚)
|
16ms |
512 KiB |
|
379 Bytes |
2022-9-26 12:12:25 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
16ms |
392 KiB |
|
372 Bytes |
2023-2-23 20:28:39 |
|
李哲 (lizhe)
|
16ms |
512 KiB |
|
509 Bytes |
2022-10-29 13:12:04 |
|
ycy
|
16ms |
512 KiB |
|
486 Bytes |
2023-1-8 14:54:01 |
|
罗翌珂 (dangdang)
|
16ms |
384 KiB |
|
455 Bytes |
2022-8-31 11:49:38 |
|
芒苒忧 (廖迦南)
|
16ms |
544 KiB |
|
410 Bytes |
2022-2-26 11:17:10 |
|
鲜榨大肠汁
|
16ms |
512 KiB |
|
381 Bytes |
2022-2-26 18:50:50 |
|
陈雨泽1
|
16ms |
384 KiB |
|
396 Bytes |
2023-2-18 11:32:28 |
|
ddz
|
16ms |
512 KiB |
|
570 Bytes |
2022-2-26 18:53:33 |
|
scallway
|
16ms |
6.9 MiB |
|
343 Bytes |
2023-10-29 13:32:03 |
|
新壹街校区-周士杰 (zsj)
|
16ms |
7 MiB |
|
375 Bytes |
2023-7-16 14:40:51 |
|
huanglu
|
16ms |
6.8 MiB |
|
466 Bytes |
2023-11-23 14:46:14 |
|
宋金龙 (songjl0421)
|
16ms |
640 KiB |
|
390 Bytes |
2022-2-26 18:52:13 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
16ms |
384 KiB |
|
372 Bytes |
2023-2-23 20:28:36 |
|
王晨志 (wangchenzhi)
|
16ms |
452 KiB |
|
749 Bytes |
2022-7-25 19:40:37 |
|
火爆肥肠(杨弘毅) (火爆肥肠)
|
16ms |
512 KiB |
|
365 Bytes |
2022-2-26 18:57:46 |
|
colin1112 (墙凌可)
|
16ms |
6.7 MiB |
|
472 Bytes |
2023-9-4 21:22:44 |
|
胡瀚文
|
16ms |
540 KiB |
|
371 Bytes |
2022-7-15 17:25:53 |
|
赵鑫宸 (xiaoxiao721)
|
16ms |
512 KiB |
|
398 Bytes |
2022-2-26 18:55:41 |
|
杜是贤 (dushixian)
|
16ms |
512 KiB |
|
366 Bytes |
2022-10-16 9:43:29 |
|
林小博
|
16ms |
556 KiB |
|
522 Bytes |
2022-7-2 9:17:07 |
|
缥 (王硕2012)
|
16ms |
552 KiB |
|
598 Bytes |
2023-2-18 12:01:03 |
|
疯神芭芭脱丝 (李卓修)
|
16ms |
540 KiB |
|
385 Bytes |
2022-7-9 19:04:02 |
|
§范马 · 猫羽雫™☠ (lixiaoxiang22031)
|
17ms |
512 KiB |
|
372 Bytes |
2023-2-23 20:28:36 |
|
罗翌珂 (dangdang)
|
17ms |
512 KiB |
|
442 Bytes |
2022-8-31 11:48:51 |
|
蒲梓勋 (puzixun)
|
17ms |
512 KiB |
|
413 Bytes |
2022-10-16 9:23:54 |