マガジンのカバー画像

Algorithm

5
運営しているクリエイター

記事一覧

Recursion

We've been wanting to ask this for a long time - "So what is Recursion?"According to LeetCode, Recursion is an approach to solving problems using a function that calls itself as a subroutine. You might wonder how we can implement a function

Array

ArrayArray is a data structure consisting of a collection of elements, each identified by at least one array index or key. The index starts from 0 (0-based numbering). Insertion, removal and search operations in arrays are fast because of r

Factorial with recursion

Ever wonder how recursion works in code? Imagine when you are given 6!, you first multiply the next integer factorial in sequence (6! = 6*5!). You repeat the process until 0 is reached. This works the same way in programming. Just think of

Stack

A stack is an abstract data type that allows operations to store and remove values in a collection of elements. All operations have a runtime complexity of O(1) because you can only delete or add an element in the top of the stack. Elements