From 42d3114f7819b9cd357bbe6b431bfd574f1ac6bb Mon Sep 17 00:00:00 2001 From: ashish Date: Mon, 6 Nov 2023 22:47:12 +0000 Subject: [PATCH] Added word break problem --- algorithms/CPlusPlus/Dynamic-Programming/word-break.cpp | 3 +++ algorithms/CPlusPlus/README.md | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/algorithms/CPlusPlus/Dynamic-Programming/word-break.cpp b/algorithms/CPlusPlus/Dynamic-Programming/word-break.cpp index 37d10eaf..49ea498a 100644 --- a/algorithms/CPlusPlus/Dynamic-Programming/word-break.cpp +++ b/algorithms/CPlusPlus/Dynamic-Programming/word-break.cpp @@ -21,6 +21,9 @@ String can be segmented as "i like" TOPICS: Dynamic Programing; Matrix Chain Multiplication Algo. +Time Complexity: O(n^3) (where n is size of string A) +Space Complexity : O(n^2) + */ diff --git a/algorithms/CPlusPlus/README.md b/algorithms/CPlusPlus/README.md index 064a599b..cc0a42a1 100644 --- a/algorithms/CPlusPlus/README.md +++ b/algorithms/CPlusPlus/README.md @@ -44,6 +44,7 @@ - [Edit Distance](Dynamic-Programming/edit-distance.cpp) - [Fibonacci](Dynamic-Programming/fibonacci.cpp) - [Rod Cutting](Dynamic-Programming/rod-cutting.cpp) +- [Word Break](Dynamic-Programming/word-break.cpp) ## Graphs @@ -60,8 +61,6 @@ - [Floyd Warshall](Graphs/floyd-warshall.cpp) - [Detecting Cycle in Directed graph using three colors](Graphs/detecting-cycle-in-a-graph-using-three-color-mechanism.cpp) - - ## Multiplication - [Karatsuba](Multiplication/karatsuba.cpp) @@ -82,6 +81,7 @@ - [Remove Duplicate in Sorted linked list](Linked-Lists/remove-duplicates-in-sorted-linked-list.cpp) - [Reverse the linked list using stack](Linked-Lists/reverse-the-list-using-stack.cpp) - [Reverse the linked list in groups of K](Linked-Lists/reverse-the-list-in-groups-of-k.cpp) + ## Searching - [Linear Search](Searching/linear-search.cpp)