# big_integer_googletest **Repository Path**: cui-rongpei/big_integer_googletest ## Basic Information - **Project Name**: big_integer_googletest - **Description**: 测试大整数问题 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-02-09 - **Last Updated**: 2025-02-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Big Integer Addition Performance Benchmark This project evaluates the performance of four different approaches for adding large integers in C++: ✅ Linked List Storage ✅ String Storage ✅ Array Storage ✅ Boost Multiprecision The performance is tested across different digit lengths and benchmarked using Google Test (GTest). ## **📌 Algorithms Overview** | **Algorithm** | **Description** | **Implementation** | **Reference** | |--------------|---------------|-------------------|----------------| | **Linked List Storage** | Each digit is stored as a node in a linked list, enabling easy digit-wise addition. | `LinkedListBigInt.h/.cpp` | Inspired by LeetCode **"2. Add Two Numbers"** | | **String Storage** | Uses `std::string` to hold numbers and processes addition via digit-wise string operations. | `StringBigInt.h/.cpp` | Inspired by LeetCode **"415. Add Strings"** | | **Array Storage** | Uses `std::vector` to store digits and perform addition efficiently. | `ArrayBigInt.h/.cpp` | Inspired by LeetCode **"989. Add to Array-Form of Integer"** | | **Boost Multiprecision** | Leverages `boost::multiprecision::cpp_int` for arbitrary-precision integer calculations. | `BoostBigInt.h/.cpp` | Uses `Boost.Multiprecision` Library | ## 📌 Features ✅ Benchmark performance for varying digit lengths (100, 200, 500, 1000, 2000, 5000, etc.) ✅ Use Google Test (GTest) for correctness validation ✅ Measure execution time per operation ✅ Generate CSV logs and visualize results using Python ## **📌 Project Structure** ```bash 📂 big_integer_test ├── 📂 include # Header files for all algorithms │ ├── LinkedListBigInt.h │ ├── StringBigInt.h │ ├── ArrayBigInt.h │ ├── BoostBigInt.h ├── 📂 src # Implementation files │ ├── LinkedListBigInt.cpp │ ├── StringBigInt.cpp │ ├── ArrayBigInt.cpp │ ├── BoostBigInt.cpp │ ├── tests.cpp # Google Test cases and benchmarks ├── 📂 scripts # Python scripts for result visualization │ ├── plot_results.py ├── build_and_run.sh # test bash scripts ├── CMakeLists.txt # CMake build configuration ├── performance_results.csv # Benchmark output file ├── README.md # Project documentation ``` ## **📌 Installation & Build** ### **1️⃣ Install Dependencies** ```bash sudo apt-get install cmake g++ libgtest-dev libboost-all-dev ``` ### **2️⃣ Build And Test Project** ```bash bash build_and_run.sh ```