Update codes/typescript/chapter_computational_complexity/time_complexity.ts

Co-authored-by: Justin Tse <xiefahit@gmail.com>
This commit is contained in:
Yudong Jin 2023-01-05 01:01:17 +08:00 committed by GitHub
parent abdf1f3117
commit c5a9eea0a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ function linear(n: number): number {
}
/* 线性阶(遍历数组) */
function arrayTraversal(nums: number[]) {
function arrayTraversal(nums: number[]): number {
let count = 0;
// 循环次数与数组长度成正比
for (let i = 0; i < nums.length; i++) {