← Back to Projects
Unreal Engine

DSExpose — Search & Sort

Unreal Engine plugin exposing Linear, Binary, and Hash search plus four sorting algorithms to C++ and Blueprints with per-call performance metadata.

C++Unreal EngineBlueprintsAlgorithmsGame Development

Overview

DSExpose is an Unreal Engine plugin (UE 4.26–5.7) that brings classic search and sorting algorithms — Linear, Binary, and Hash search alongside Bubble, Insertion, Quick, and Merge Sort — into Blueprint with zero boilerplate. Every algorithm operates on int32, float, and FString arrays and returns a result struct that includes the output alongside performance metadata (execution time, comparisons, swaps), making it equally suited for production AI/gameplay logic and educational projects where players observe algorithm behavior directly.

Key Features

  • Three search strategies — Linear O(N), Binary O(log N) with Validate/AutoSort modes, and Hash O(1) average via TMap, all accessible from a single unified Blueprint node
  • Four sorting algorithms — Bubble Sort, Insertion Sort, iterative QuickSort (explicit stack, stack-overflow-safe), and Merge Sort with a single pre-allocated auxiliary buffer (O(1) allocations)
  • Per-call performance metadata — every sort returns FSortMetadata with ExecutionTimeMs, Comparisons, and Swaps for direct in-Blueprint algorithm comparison
  • Three data types — all algorithms exposed for int32, float, and FString (12 sort Blueprint functions, 6 search functions)
  • MoveTemp()-based sort pipeline — BP wrappers transfer array ownership instead of copying, eliminating the second full-array copy that the naive approach would incur
  • Cross-version compatibilityDSA_VersionMacros.h abstracts TObjectPtr<> and EAllowShrinking differences across UE 4.26–5.7

Technical Decisions

The sort pipeline was designed to eliminate unnecessary copies: template sort functions build a result in place, and Blueprint wrappers use MoveTemp() to transfer the sorted array buffer rather than duplicating it. Merge Sort uses a single auxiliary buffer pre-allocated at the top-level call and reused across all recursive merge operations, reducing allocations from O(N log N) to one. QuickSort is iterative with an explicit TArray-backed stack (reserved to 64 entries) to eliminate recursion-depth risk on pathological inputs. Binary search’s Validate mode was optimized to avoid copying the input array — it checks sort order and searches on the original const& directly, only falling back to a copy in AutoSort mode.