ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Parentheses.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*--------------------------- File Parentheses.h ---------------------------*/
3/*--------------------------------------------------------------------------*/
37/*--------------------------------------------------------------------------*/
38/*----------------------------- DEFINITIONS --------------------------------*/
39/*--------------------------------------------------------------------------*/
40
41#ifndef __ADS_Parentheses
42 #define __ADS_Parentheses
43/* self-identification: #endif constant */
44
45/*--------------------------------------------------------------------------*/
46/*------------------------------ INCLUDES ----------------------------------*/
47/*--------------------------------------------------------------------------*/
48
49#include "ADS/Contract.h"
50
51#include <cstddef>
52#include <string_view>
53#include <utility>
54#include <vector>
55
56/*--------------------------------------------------------------------------*/
57/*--------------------------- NAMESPACE ------------------------------------*/
58/*--------------------------------------------------------------------------*/
59
60namespace ADS
61{
62
86[[nodiscard]] inline std::size_t
87longestBalancedSubsequence( std::string_view s , char open = '(' ,
88 char close = ')' );
89
124[[nodiscard]] inline std::pair< std::size_t , std::size_t >
125longestBalancedSubstring( std::string_view s , char open = '(' ,
126 char close = ')' );
127
128/*--------------------------------------------------------------------------*/
129
130} // end( namespace ADS )
131
132/*--------------------------------------------------------------------------*/
133/*-------------------------- IMPLEMENTATION --------------------------------*/
134/*--------------------------------------------------------------------------*/
135
136#include "ADS/string/impl/Parentheses.tpp"
137
138/*--------------------------------------------------------------------------*/
139
140#endif /* Parentheses.h included */
141
142/*--------------------------------------------------------------------------*/
143/*------------------------- End File Parentheses.h -------------------------*/
144/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::size_t longestBalancedSubsequence(std::string_view s, char open='(', char close=')')
the length of a longest subsequence of that is a balanced string of the parentheses open and close
std::pair< std::size_t, std::size_t > longestBalancedSubstring(std::string_view s, char open='(', char close=')')
where the leftmost of the longest balanced substrings of starts and its length, if there is none
Definition ADT.h:96