Discover the telltale signs, patterns, and characteristics that distinguish AI-written code from human code with our comprehensive guide.
AI tends to over-document with comprehensive comments explaining even simple operations
Extremely consistent variable and function naming without the natural variations humans introduce
Solutions that follow textbook patterns rather than the creative approaches humans often take
Unnaturally consistent code formatting and style throughout the entire codebase
Look for overly explanatory comments that describe even simple operations in detail
AI often includes comprehensive error handling for every possible scenario
AI tends to use standard library functions rather than creative or unconventional approaches
Check for same structural patterns repeated throughout different parts of the code
// Quick sort implementation I wrote
// Not the most efficient but it works for my use case
function quickSort(arr) {
if (arr.length <= 1) return arr;
// I prefer using middle element as pivot
const pivotIdx = Math.floor(arr.length / 2);
const pivot = arr[pivotIdx];
// These could be optimized but keeping it simple for now
const less = arr.filter((x, i) => x < pivot && i != pivotIdx);
const equal = arr.filter(x => x === pivot);
const greater = arr.filter((x, i) => x > pivot && i != pivotIdx);
// TODO: fix edge case with duplicate values
return [...quickSort(less), ...equal, ...quickSort(greater)];
}
/**
* Implementation of the QuickSort algorithm.
* QuickSort is a divide-and-conquer algorithm that works by
* selecting a 'pivot' element and partitioning the array around the pivot.
* @param {Array} arr - The array to be sorted
* @returns {Array} - The sorted array
*/
function quickSort(arr) {
// Base case: arrays with 0 or 1 element are already sorted
if (arr.length <= 1) {
return arr;
}
// Select the pivot element (middle element of the array)
const pivotIndex = Math.floor(arr.length / 2);
const pivotValue = arr[pivotIndex];
// Partition the array into three parts:
// Elements less than pivot, elements equal to pivot, and elements greater than pivot
const lessThanPivot = arr.filter((element, index) => element < pivotValue && index !== pivotIndex);
const equalToPivot = arr.filter(element => element === pivotValue);
const greaterThanPivot = arr.filter((element, index) => element > pivotValue && index !== pivotIndex);
// Recursively sort the sub-arrays and combine the results
return [...quickSort(lessThanPivot), ...equalToPivot, ...quickSort(greaterThanPivot)];
}
Try our advanced detection tool today with over 95% accuracy.
Try It Free