How otniel113/tugasbesaraka works
Project type and purpose
• This is a standalone, console-based algorithm comparison tool written in C/C++.
• Its purpose is to generate a random array of user-specified length, sort it using BubbleSort and MergeSort, measure execution times, and display the results.
File structure
• Top level:
• README.md, PPT.pptx, Laporan_1301180469_1301180392.pdf (documentation)
• Source Code/MergeBubbleSortV2 (Code::Blocks project)
• Source Code/MergeBubbleSortV2 contains:
• header.h – declarations of functions and includes
• source.cpp – implementations of sorting and helper functions
• main.cpp – driver orchestrating user I/O, array generation, timing, and calls into source.cpp
• bin/Debug – compiled executable
• obj/Debug – object files
• .cbp, .depend, .layout – project metadata for Code::Blocks
README for additional insights
• Describes program flow: input array length → random array creation → main menu with options to display array, run BubbleSort (O(n²)), run MergeSort (O(n log n)), reset array, or exit.
• Notes that runtime measurements are shown in milliseconds.
• No external services or persistent storage.
Main components
a. User (Console)
b. Main Module (main.cpp)
c. Utility Module (header.h + source.cpp)
– Random Array Generator
– BubbleSort function
– MergeSort function
– Timer/Performance Measurement
d. Output Renderer (console printing)
Relationships and interactions
• User → (inputs array length) → Main Module
• Main Module → (calls) → Random Array Generator → returns array
• Main Module → displays menu → User selects option
• If “Display Array”: Main Module → Output Renderer
• If “BubbleSort” or “MergeSort”: Main Module → Timer start → calls respective sort function in Utility Module → Timer stop → returns sorted array + duration → Main Module → Output Renderer
• If “Reset Array”: Main Module → Random Array Generator
• Exit option terminates the process
Architectural patterns and design principles
• Separation of concerns:
• I/O logic in main.cpp
• Algorithm implementations in source.cpp/header.h
• Build artifacts separated under bin/ and obj/
• Modular design enables adding more sorting algorithms or features without touching driver code heavily.
Relevant technologies
• Language: C++ (with C linkage where needed)
• Build system: Code::Blocks project (.cbp files), GNU GCC toolchain
• Standard library: <chrono> for timing, <vector> or raw arrays for data, <random> or srand/rand