From 153846c94b3008e67c46d9ff1302f8a2fe9509ab Mon Sep 17 00:00:00 2001 From: Gonglja Date: Thu, 12 Jan 2023 21:09:51 +0800 Subject: [PATCH] feat(codes/c/): add array_stack and linkedlist_stack frame --- codes/c/CMakeLists.txt | 1 + .../c/chapter_stack_and_queue/CMakeLists.txt | 2 + codes/c/chapter_stack_and_queue/array_stack.c | 43 +++++++++++++++++++ .../linkedlist_stack.c | 42 ++++++++++++++++++ codes/c/chapter_tree/binary_search_tree.c | 3 ++ 5 files changed, 91 insertions(+) create mode 100644 codes/c/chapter_stack_and_queue/CMakeLists.txt create mode 100644 codes/c/chapter_stack_and_queue/array_stack.c create mode 100644 codes/c/chapter_stack_and_queue/linkedlist_stack.c diff --git a/codes/c/CMakeLists.txt b/codes/c/CMakeLists.txt index 1a208dd9d..932d74fd1 100644 --- a/codes/c/CMakeLists.txt +++ b/codes/c/CMakeLists.txt @@ -10,3 +10,4 @@ add_subdirectory(chapter_computational_complexity) add_subdirectory(chapter_array_and_linkedlist) add_subdirectory(chapter_sorting) add_subdirectory(chapter_tree) +add_subdirectory(chapter_stack_and_queue) diff --git a/codes/c/chapter_stack_and_queue/CMakeLists.txt b/codes/c/chapter_stack_and_queue/CMakeLists.txt new file mode 100644 index 000000000..5c2be36b6 --- /dev/null +++ b/codes/c/chapter_stack_and_queue/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(array_stack array_stack.c) +add_executable(linkedlist_stack linkedlist_stack.c) \ No newline at end of file diff --git a/codes/c/chapter_stack_and_queue/array_stack.c b/codes/c/chapter_stack_and_queue/array_stack.c new file mode 100644 index 000000000..df7e08139 --- /dev/null +++ b/codes/c/chapter_stack_and_queue/array_stack.c @@ -0,0 +1,43 @@ +/** + * File: array_stack.c + * Created Time: 2022-01-12 + * Author: Zero (glj0@outlook.com) + */ + +#include "../include/include.h" + + +struct ArrayStack { + int *array; + size_t stkSize; +}; + +typedef struct ArrayStack ArrayStack; + +void new(ArrayStack* stk) { + +} + +size_t size(ArrayStack* stk) { + +} + +bool empty(ArrayStack* stk) { + +} + +void push(ArrayStack* stk, int num) { + +} + +void pop(ArrayStack* stk) { + +} + +int top(ArrayStack* stk) { + +} + +int main() { + return 0; +} \ No newline at end of file diff --git a/codes/c/chapter_stack_and_queue/linkedlist_stack.c b/codes/c/chapter_stack_and_queue/linkedlist_stack.c new file mode 100644 index 000000000..e190d3d63 --- /dev/null +++ b/codes/c/chapter_stack_and_queue/linkedlist_stack.c @@ -0,0 +1,42 @@ +/** + * File: linkedlist_stack.c + * Created Time: 2022-01-12 + * Author: Zero (glj0@outlook.com) + */ + +#include "../include/include.h" + +struct LinkedListStack { + ListNode* stkTop; + size_t stkSize; +}; + +typedef struct LinkedListStack LinkedListStack; + +void new(LinkedListStack* stk) { + +} + +size_t size(LinkedListStack* stk) { + +} + +bool empty(LinkedListStack* stk) { + +} + +void push(LinkedListStack* stk, int num) { + +} + +void pop(LinkedListStack* stk) { + +} + +int top(LinkedListStack* stk) { + +} + +int main() { + return 0; +} diff --git a/codes/c/chapter_tree/binary_search_tree.c b/codes/c/chapter_tree/binary_search_tree.c index f993faec3..908216db4 100644 --- a/codes/c/chapter_tree/binary_search_tree.c +++ b/codes/c/chapter_tree/binary_search_tree.c @@ -6,3 +6,6 @@ #include "../include/include.h" +int main() { + return 0; +} \ No newline at end of file