/DataStructure-Algorithm-Cpp

A library of Data Structure and Algorithm implemented by C++

Primary LanguageC++MIT LicenseMIT

DataStructure-Algorithm-Cpp

A library of Data Structure And Algorithm implemented by C++

About Project

Try to use it!

  • You can open it in Clion, and install the google-test src in the lib directory (Dependence):
git clone https://github.com/Straydragonl/DataStructure-Algorithm-Cpp.git \
cd DataStructure-Algorithm-Cpp \
mkdir lib \
cd lib \
git clone https://github.com/google/googletest.git
# Use Clion open the project (DataStructure-Algorithm-Cpp)
  • or install manually by terminal:
git clone https://github.com/Straydragonl/DataStructure-Algorithm-Cpp.git \
cd DataStructure-Algorithm-Cpp \
mkdir lib \
cd lib \
git clone https://github.com/google/googletest.git
cd .. \
cmake . \
make

UML Class Relation Diagram

Chief Structure

src
├── ADTs
│   ├── exceptions
│   ├── interfaces
│   │   ├── BinaryTree.h
│   │   ├── Dictionary.h
│   │   ├── Graph.h
│   │   ├── Heap.h
│   │   ├── List.h
│   │   ├── Queue.h
│   │   └── Stack.h
│   ├── AdjacencyMatrixGraph.cpp
│   ├── AdjacencyMatrixGraph.h
│   ├── ArrayHeap.cpp
│   ├── ArrayHeap.h
│   ├── ArrayList.cpp
│   ├── ArrayList.h
│   ├── ArrayQueue.cpp
│   ├── ArrayQueue.h
│   ├── ArrayStack.cpp
│   ├── ArrayStack.h
│   ├── BinaryNode.h
│   ├── BinaryNodeTree.cpp
│   ├── BinaryNodeTree.h
│   ├── BinarySearchTree.cpp
│   ├── BinarySearchTree.h
│   ├── LinkedList.cpp
│   ├── LinkedList.h
│   ├── LinkedQueue.cpp
│   ├── LinkedQueue.h
│   ├── LinkedStack.cpp
│   ├── LinkedStack.h
│   ├── ListQueue.cpp
│   ├── ListQueue.h
│   ├── Node.h
│   └── TreeNode.h
├── Algorithms
│   ├── RawArraySort.cpp
│   └── RawArraySort.h
└── Experiments

TODO

Code

ADTs

  • List and implementations :
    • ArrayList
    • LinkedList
  • Stack and implementations :
    • ArrayList
    • LinkedList
  • Queue and implementations :
    • ArrayQueue
    • LinkedQueue
    • ListQueue
  • BinaryTree and implementations :
    • BinaryNodeTree
    • BinarySearchTree
  • Heap and implementations :
    • ArrayHeap
    • ...
  • Dictionary and implementations :
    • ...
  • Graph and implementations :
    • ...

Algorithms

  • Basic on raw type [] sort algorithms:
    • selectionSort
    • bubbleSort
    • insertionSort
    • mergeSort
    • quickSort
    • radixSort
    • heapSort
    • treeSort (Base on BinarySearchTree)

Style

  • Code Specification

    • Identifier(Class:private,public,method...)
      • Java Style but private/protected members have prefix '_'
    • Indent and auto format style...
      • Look up .clang-format
    • C++ version
      • C++11
    • Target compiler:
      • G++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
    • Target Platform
      • Linux
  • Design principle

  • ......

Bugs:

  • [1] Weird Segmentation Fault See report issue
    • When: Test the LinkedQueue copy constructor When new a Node<E>
      • Error1: Segmentation Fault (G++)
      • Error2: Not expect result (Clang++)

👍 Good Learning Reference: