Skip to content

Latest commit

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ceaser_cpp_content

A C++ library containing common algorithms and data structures for personal use.

Author

ceaserzhao

Table of Contents

Overview

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.

Features

Sorting Algorithms

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Quick Sort
  • Merge Sort

Searching Algorithms

  • Linear Search
  • Binary Search

Data Structures

  • Singly Linked List
  • Stack
  • Queue
  • Binary Tree
  • Binary Search Tree

Installation

Prerequisites

  • C++11 or later
  • CMake 3.10 or later
  • A C++ compiler (GCC, Clang, MSVC, etc.)

Building the Library

  1. Clone or download the repository
  2. Create a build directory:
    mkdir build
    cd build
  3. Run CMake to configure the project:
    cmake ..
  4. Build the library and example:
    cmake --build .

Usage

Including the Library

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"usingnamespaceceaser_cpp_content;

Example Usage

Sorting Algorithms

#include<vector>
#include"sorting.h"usingnamespaceceaser_cpp_content;intmain() {
std::vector<int> arr = {64, 34, 25, 12, 22, 11, 90};
// Use any sorting algorithmquick_sort(arr);
return0;
}

Data Structures

#include"linked_list.h"usingnamespaceceaser_cpp_content;intmain() {
LinkedList ll;
ll.insert_at_end(10);
ll.insert_at_end(20);
ll.display();
return0;
}

Examples

The examples directory contains a comprehensive demo program that showcases all the features of the library. You can run it after building:

./example

Project Structure

ceaser_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

License

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.

About

personal cpp lib

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages