Add code source blocks to the chapter Graph.

Fix "函数" and "方法"
This commit is contained in:
krahets
2023-02-10 01:04:26 +08:00
parent d37c71b928
commit 300016393b
47 changed files with 106 additions and 409 deletions

View File

@@ -16,7 +16,7 @@ struct ArrayQueue {
typedef struct ArrayQueue ArrayQueue;
/* 构造函数 */
/* 构造方法 */
ArrayQueue *newArrayQueue(int capacity) {
ArrayQueue *queue = (ArrayQueue *) malloc(sizeof(ArrayQueue));
// 初始化数组
@@ -26,7 +26,7 @@ ArrayQueue *newArrayQueue(int capacity) {
return queue;
}
/* 析构函数 */
/* 析构方法 */
void delArrayQueue(ArrayQueue *queue) {
free(queue->nums);
queue->queCapacity = 0;

View File

@@ -14,7 +14,7 @@ struct linkedListStack {
typedef struct linkedListStack linkedListStack;
/* 构造函数 */
/* 构造方法 */
linkedListStack *newLinkedListStack() {
linkedListStack *s = malloc(sizeof(linkedListStack));
s->top = NULL;
@@ -22,7 +22,7 @@ linkedListStack *newLinkedListStack() {
return s;
}
/* 析构函数 */
/* 析构方法 */
void delLinkedListStack(linkedListStack *s) {
while (s->top) {
ListNode *n = s->top->next;
@@ -80,7 +80,7 @@ int pop(linkedListStack *s) {
/* Driver Code */
int main() {
/* 初始化栈 */
// 构造函数
// 构造方法
linkedListStack *stack = newLinkedListStack();
/* 元素入栈 */
@@ -109,7 +109,7 @@ int main() {
bool empty = isEmpty(stack);
printf("栈是否为空 = %s\n", empty ? "true" : "false");
/* 析构函数 */
/* 析构方法 */
delLinkedListStack(stack);
return 0;
}