TikTok algorithm works by recommending relevant videos based on the information about the video and user activity (likes, comments, and shares).