From c0e29c9af35816977cd0ed3f3de297ef19dd4156 Mon Sep 17 00:00:00 2001 From: Aryan Date: Sat, 8 Jul 2023 12:24:12 +0530 Subject: [PATCH] added TC and SC of code --- algorithms/CPlusPlus/Arrays/subarray-product.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/algorithms/CPlusPlus/Arrays/subarray-product.cpp b/algorithms/CPlusPlus/Arrays/subarray-product.cpp index 85b04d8c..a4e1b8a4 100644 --- a/algorithms/CPlusPlus/Arrays/subarray-product.cpp +++ b/algorithms/CPlusPlus/Arrays/subarray-product.cpp @@ -23,6 +23,9 @@ Proof - and hence we shift to the element to immediate right and do the same process . */ +// TIme Complexity of Code - O (n ^2 ) since outer loop -> n times and inner loop (worst case ) -> n times so TC = n * n +// Space Complexity of Code - O (1) since does not use any auxillary space + // Implementation #include