A C++ library containing common algorithms and data structures for personal use.
ceaserzhao
ceaser_cpp_content is a C++ library that provides implementations of various common algorithms and data structures. It is designed to be simple, easy to use, and educational.
- Bubble Sort
- Selection Sort
- Insertion Sort
- Quick Sort
- Merge Sort
- Linear Search
- Binary Search
- Singly Linked List
- Stack
- Queue
- Binary Tree
- Binary Search Tree
- C++11 or later
- CMake 3.10 or later
- A C++ compiler (GCC, Clang, MSVC, etc.)
- Clone or download the repository
- Create a build directory:
mkdir build cd build - Run CMake to configure the project:
cmake ..
- Build the library and example:
cmake --build .
Add the include directory to your project's include path and link against the built library.
#include "sorting.h"
#include "searching.h"
#include "linked_list.h"
#include "stack.h"
#include "queue.h"
#include "tree.h"
using namespace ceaser_cpp_content;#include <vector>
#include "sorting.h"
using namespace ceaser_cpp_content;
int main() {
std::vector<int> arr = {64, 34, 25, 12, 22, 11, 90};
// Use any sorting algorithm
quick_sort(arr);
return 0;
}#include "linked_list.h"
using namespace ceaser_cpp_content;
int main() {
LinkedList ll;
ll.insert_at_end(10);
ll.insert_at_end(20);
ll.display();
return 0;
}The examples directory contains a comprehensive demo program that showcases all the features of the library. You can run it after building:
./exampleceaser_cpp_content/
├── include/ # Header files
│ ├── sorting.h # Sorting algorithms
│ ├── searching.h # Searching algorithms
│ ├── linked_list.h # Linked list implementation
│ ├── stack.h # Stack implementation
│ ├── queue.h # Queue implementation
│ └── tree.h # Tree implementations
├── src/ # Source files
│ ├── sorting.cpp # Sorting algorithms implementation
│ ├── searching.cpp # Searching algorithms implementation
│ ├── linked_list.cpp # Linked list implementation
│ ├── stack.cpp # Stack implementation
│ ├── queue.cpp # Queue implementation
│ └── tree.cpp # Tree implementations
├── examples/ # Example programs
│ └── main.cpp # Comprehensive demo
├── CMakeLists.txt # CMake build configuration
└── README.md # This file
This project is licensed under the MIT License. The MIT License is a permissive open-source license that allows for reuse, modification, and distribution of the code, both for commercial and non-commercial purposes, with minimal restrictions.