基於snakeyaml讀取yml配置檔案生成JAVA複雜物件
阿新 • • 發佈:2020-12-15
棧:
Last in First out 線性表,故又稱作LIFO結構。
順序儲存:空棧設棧頂指標為-1;否則為陣列下標。
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #pragma warning (disable:4996) #define MAXSIZE 1000 typedef int SElemType; typedef struct { SElemType data[MAXSIZE]; int top;//棧頂pointer }SqStack; bool push(SqStack* S, SElemType e) {if (S->top = MAXSIZE - 1) { return 0; } S->top++; S->data[S->top] = e; return 1; } bool pop(SqStack* S, SElemType* e) { if (S->top == -1) { return 0; } *e = S->data[S->top]; S->top--; return 1; }
當要處理的兩組資料具有一定負相關性時,使用兩棧共享空間可以比較好的解決問題。
鏈棧:
以頭結點處的指標作為棧頂指標,使頭節點失去意義。
鏈棧的基本操作同單鏈表,具體有什麼區別待學習QAQ
棧的應用:
遞迴:非常自然地可以發現,遞迴的邏輯與棧的LIFO非常相似。故系統在實現遞迴時,會使用棧的結構。一般我們不需要自己管理這個棧。