|
colin1112 (墙凌可)
|
4ms |
428 KiB |
|
268 Bytes |
2023-3-11 14:56:34 |
|
胡宸华 (huchenhua)
|
4ms |
428 KiB |
|
322 Bytes |
2022-11-7 8:50:07 |
|
RanHao
|
4ms |
6.9 MiB |
|
231 Bytes |
2023-7-22 11:22:01 |
|
新一街校区Jason_LuoYouZheng (罗友峥)
|
4ms |
432 KiB |
|
219 Bytes |
2022-3-1 22:08:36 |
|
李晨希
|
4ms |
6.9 MiB |
|
297 Bytes |
2023-6-28 10:56:51 |
|
芒苒忧 (廖迦南)
|
4ms |
512 KiB |
|
235 Bytes |
2022-8-16 15:25:47 |
|
xflt_dyp
|
4ms |
6.9 MiB |
|
231 Bytes |
2023-7-22 16:57:14 |
|
dream
|
5ms |
7.5 MiB |
|
294 Bytes |
2023-7-9 9:58:32 |
|
手搓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 |
416 KiB |
|
242 Bytes |
2023-5-27 11:10:59 |
|
贾鑫豪 (Mr Sam)
|
5ms |
424 KiB |
|
253 Bytes |
2022-9-3 11:49: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)
|
5ms |
6.7 MiB |
|
2 KiB |
2023-9-12 20:41:07 |
|
yanglang
|
5ms |
436 KiB |
|
252 Bytes |
2022-10-22 21:30:50 |
|
时代一校-赵彦博 (zyb)
|
5ms |
6.9 MiB |
|
241 Bytes |
2023-7-15 11:09:26 |
|
爱琴海校区-刁钲洋 (刁钲洋)
|
5ms |
7 MiB |
|
357 Bytes |
2023-7-10 11:39:38 |
|
马渝杭 (mayuhang)
|
5ms |
444 KiB |
|
276 Bytes |
2023-1-8 13:28:41 |
|
黄梓桐 (HuangZiTong)
|
5ms |
440 KiB |
|
228 Bytes |
2022-7-15 17:19:33 |
|
wuqi
|
5ms |
6.9 MiB |
|
285 Bytes |
2023-8-2 16:18:12 |
|
郑岐蔚
|
5ms |
436 KiB |
|
272 Bytes |
2023-1-26 14:41:20 |
|
zzzrrrxxx
|
5ms |
6.9 MiB |
|
196 Bytes |
2023-8-11 10:42:57 |
|
江子墨
|
5ms |
7 MiB |
C++98 |
266 Bytes |
2024-6-9 9:43:40 |
|
wuqi
|
5ms |
6.9 MiB |
|
285 Bytes |
2023-8-2 16:19:24 |
|
ganlin1
|
5ms |
6.9 MiB |
|
207 Bytes |
2023-7-21 17:50:51 |
|
科比.布莱恩特 (董浩琰)
|
5ms |
7.5 MiB |
|
242 Bytes |
2023-7-20 19:01:49 |
|
贾博涵
|
5ms |
6.9 MiB |
|
229 Bytes |
2023-11-10 10:34:05 |
|
代尚函 笛卡尔 (daishanghan)
|
5ms |
6.9 MiB |
|
229 Bytes |
2023-8-3 11:44:29 |
|
Tender. (05c05-zhou)
|
5ms |
512 KiB |
|
235 Bytes |
2022-10-17 20:47:31 |
|
嘉宝 (王淳恺)
|
6ms |
7.1 MiB |
|
242 Bytes |
2023-7-6 13:58:27 |
|
程曦漫
|
6ms |
7 MiB |
|
219 Bytes |
2024-1-5 19:20:25 |
|
郭睿
|
6ms |
6.8 MiB |
|
219 Bytes |
2023-11-17 22:15:42 |
|
ysf.wlanwq.ZJSWL 1922~1991 (韦舒豪)
|
7ms |
7 MiB |
|
279 Bytes |
2024-1-6 11:23:36 |
|
kapurua
|
7ms |
7.3 MiB |
|
231 Bytes |
2024-1-22 16:08:01 |
|
JOKER (hhy)
|
8ms |
6.9 MiB |
|
283 Bytes |
2023-12-8 19:48:59 |
|
廖海宇在追杀马牌痞 (liaohaiyu22031)
|
8ms |
7 MiB |
|
263 Bytes |
2023-12-3 13:39:22 |
|
一个小黑
|
10ms |
6.9 MiB |
|
216 Bytes |
2023-11-10 19:25:18 |
|
郭睿
|
10ms |
6.8 MiB |
|
219 Bytes |
2023-11-17 22:15:47 |
|
牟淳雅
|
18ms |
532 KiB |
|
221 Bytes |
2024-4-4 11:31:18 |
|
在煎鱼的肖大总铳 (肖宇航)
|
19ms |
532 KiB |
|
248 Bytes |
2024-3-17 9:16:50 |
|
没有此人 (akm)
|
20ms |
768 KiB |
|
361 Bytes |
2024-3-6 19:32:08 |
|
城市之光1
|
20ms |
532 KiB |
|
210 Bytes |
2024-4-13 11:42:10 |
|
A小涂
|
20ms |
532 KiB |
|
229 Bytes |
2024-3-15 18:51:48 |
|
sunxiaozhu
|
21ms |
764 KiB |
|
225 Bytes |
2024-3-20 21:20:49 |
|
jdy
|
21ms |
532 KiB |
|
278 Bytes |
2024-3-14 17:00:18 |
|
超级管理员 (root)
|
22ms |
552 KiB |
C++98(O2) |
311 Bytes |
2024-11-9 17:20:41 |
|
My name is Man (钟卓劭)
|
22ms |
764 KiB |
|
227 Bytes |
2024-2-25 14:39:44 |
|
tongxiao
|
22ms |
536 KiB |
|
261 Bytes |
2024-4-11 13:04:49 |
|
佐子佑
|
22ms |
544 KiB |
|
235 Bytes |
2024-2-2 10:25:16 |
|
俞伏羲
|
22ms |
764 KiB |
|
202 Bytes |
2024-4-13 11:35:40 |
|
叶哲宇 (yzy)
|
22ms |
764 KiB |
|
240 Bytes |
2024-3-24 21:51:09 |
|
司雨来 (siyulai)
|
23ms |
532 KiB |
C++98 |
287 Bytes |
2024-11-10 11:08:48 |
|
赵奕铭
|
23ms |
548 KiB |
|
267 Bytes |
2024-3-12 22:03:40 |
|
Turorany (郑浩然)
|
24ms |
776 KiB |
C++98 |
269 Bytes |
2024-9-20 21:22:15 |
|
时代2校+施皓宬 (shihaocheng)
|
24ms |
536 KiB |
C++11 |
225 Bytes |
2024-10-27 9:25:58 |
|
张祖名
|
25ms |
536 KiB |
|
306 Bytes |
2024-3-17 11:08:32 |
|
fcxin
|
35ms |
9.3 MiB |
Python 3 |
112 Bytes |
2024-8-8 11:52:46 |
|
cym
|
51ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:43 |
|
孙烽轶 (sfy)
|
52ms |
3.9 MiB |
Python 3 |
162 Bytes |
2022-5-28 15:44:48 |
|
文晟宇
|
52ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:49 |
|
王锦锐 (wjr)
|
52ms |
3.8 MiB |
Python 3 |
150 Bytes |
2022-6-26 10:33:02 |
|
123456789012345678901234567890 (罗传智)
|
52ms |
4 MiB |
Python 3 |
142 Bytes |
2022-6-26 10:25:13 |
|
杨浩灵 (金坷拉)
|
52ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-5-28 15:45:56 |
|
文晟宇
|
53ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:55 |
|
cym
|
53ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:44 |
|
文晟宇
|
53ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:53 |
|
猫不理包子
|
53ms |
9.1 MiB |
Python 3 |
189 Bytes |
2023-7-14 10:36:43 |
|
文晟宇
|
53ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:34:13 |
|
苗润昊
|
53ms |
3.9 MiB |
Python 3 |
130 Bytes |
2022-1-25 17:48:04 |
|
文晟宇
|
53ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:50 |
|
文晟宇
|
53ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:52 |
|
cym
|
53ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:45 |
|
hehaolei
|
54ms |
3.8 MiB |
Python 3 |
158 Bytes |
2022-5-28 15:47:12 |
|
王锦锐 (wjr)
|
54ms |
3.9 MiB |
Python 3 |
150 Bytes |
2022-6-26 10:33:04 |
|
19598
|
54ms |
9 MiB |
Python 3 |
165 Bytes |
2023-8-12 10:56:43 |
|
文晟宇
|
54ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:54 |
|
文晟宇
|
54ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:55 |
|
赵梓妤
|
54ms |
3.8 MiB |
Python 3 |
144 Bytes |
2022-6-26 10:30:51 |
|
你猜呀
|
54ms |
3.8 MiB |
Python 3 |
150 Bytes |
2022-6-26 10:26:34 |
|
cym
|
54ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:46 |
|
cym
|
54ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:46 |
|
梨冻亿 (wiueh)
|
54ms |
3.9 MiB |
Python 3 |
146 Bytes |
2022-1-23 16:34:58 |
|
cym
|
55ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:42 |
|
文晟宇
|
55ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:48 |
|
cym
|
55ms |
3.8 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:34:22 |
|
cym
|
55ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-7-12 16:36:37 |
|
文晟宇
|
55ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:55 |
|
任童(rentong)
|
55ms |
3.9 MiB |
Python 3 |
153 Bytes |
2022-2-10 12:01:50 |
|
文晟宇
|
55ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:53 |
|
edy
|
55ms |
9 MiB |
Python 2 |
136 Bytes |
2023-10-14 12:03:24 |
|
熊第1
|
55ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:35:24 |
|
谭红中 (不知道)
|
55ms |
4 MiB |
Python 3 |
148 Bytes |
2022-3-31 21:19:15 |
|
114514 (wangjunling)
|
55ms |
4 MiB |
Python 3 |
137 Bytes |
2022-8-18 14:24:43 |
|
文晟宇
|
56ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:53 |
|
cym
|
56ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:45 |
|
伍行念 (wuxingnian)
|
56ms |
9.1 MiB |
Python 3 |
144 Bytes |
2023-9-24 11:41:38 |
|
cola
|
56ms |
4 MiB |
Python 3 |
207 Bytes |
2022-12-15 22:39:13 |
|
文晟宇
|
56ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:54 |
|
安闵煜 (anzai)
|
57ms |
9 MiB |
Python 3 |
136 Bytes |
2023-11-6 1:26:11 |
|
秦兴润
|
57ms |
3.9 MiB |
Python 3 |
142 Bytes |
2022-6-26 10:35:10 |
|
cym
|
58ms |
3.9 MiB |
Python 3 |
151 Bytes |
2022-6-26 10:42:44 |
|
wangmiaoxin
|
59ms |
3.8 MiB |
Python 3 |
142 Bytes |
2022-5-22 16:43:07 |
|
文晟宇
|
59ms |
3.9 MiB |
Python 3 |
148 Bytes |
2022-6-26 10:57:52 |