mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 00:46:28 +08:00
feat(codes/c/): add array_stack and linkedlist_stack frame
This commit is contained in:
parent
cbbb7d34b2
commit
153846c94b
5 changed files with 91 additions and 0 deletions
|
@ -10,3 +10,4 @@ add_subdirectory(chapter_computational_complexity)
|
||||||
add_subdirectory(chapter_array_and_linkedlist)
|
add_subdirectory(chapter_array_and_linkedlist)
|
||||||
add_subdirectory(chapter_sorting)
|
add_subdirectory(chapter_sorting)
|
||||||
add_subdirectory(chapter_tree)
|
add_subdirectory(chapter_tree)
|
||||||
|
add_subdirectory(chapter_stack_and_queue)
|
||||||
|
|
2
codes/c/chapter_stack_and_queue/CMakeLists.txt
Normal file
2
codes/c/chapter_stack_and_queue/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
add_executable(array_stack array_stack.c)
|
||||||
|
add_executable(linkedlist_stack linkedlist_stack.c)
|
43
codes/c/chapter_stack_and_queue/array_stack.c
Normal file
43
codes/c/chapter_stack_and_queue/array_stack.c
Normal file
|
@ -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;
|
||||||
|
}
|
42
codes/c/chapter_stack_and_queue/linkedlist_stack.c
Normal file
42
codes/c/chapter_stack_and_queue/linkedlist_stack.c
Normal file
|
@ -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;
|
||||||
|
}
|
|
@ -6,3 +6,6 @@
|
||||||
|
|
||||||
#include "../include/include.h"
|
#include "../include/include.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue