Given an array of integers, write an algorithm to detect if a specific number is a perfect square without using built-in library functions.