From 47a57f4eaf072eeb5848d05071d29f9e5733fbd5 Mon Sep 17 00:00:00 2001 From: Ajiri Osiobe Date: Fri, 17 May 2024 01:29:21 +0100 Subject: [PATCH] Update contains.js with time and space complexity --- algorithms/JavaScript/src/recursion/contains.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/algorithms/JavaScript/src/recursion/contains.js b/algorithms/JavaScript/src/recursion/contains.js index 54ebe194c..8682896dc 100644 --- a/algorithms/JavaScript/src/recursion/contains.js +++ b/algorithms/JavaScript/src/recursion/contains.js @@ -36,3 +36,7 @@ const contains = (object, checkValue) => { return false; }; + +//Note +//Time Complexity: 𝑂(𝑛) where n is the total number of key-value pairs in the object. +//Space Complexity: 𝑂(𝑑) where d is the maximum depth of nested objects.