Main function.
-
Definition at line 141 of file postfix_evaluation.cpp.
-
141 {
-
142 std::array<std::string, 43> input = {
-
143 "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
-
144 "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
-
145 "+", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+",
-
146 "+", "+", "+", "+", "+", "+", "+", "+", "+", "+"};
-
-
148
-
149 assert(answer == 22);
-
150}
+
Definition at line 136 of file postfix_evaluation.cpp.
+
136 {
+
137 std::vector<std::string> input = {
+
138 "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
+
139 "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
+
140 "+", "+", "+", "+", "+", "+", "+", "+", "+", "+", "+",
+
141 "+", "+", "+", "+", "+", "+", "+", "+", "+", "+"};
+
+
143
+
144 assert(answer == 22);
+
145}
diff --git a/d7/d75/postfix__evaluation_8cpp.js b/d7/d75/postfix__evaluation_8cpp.js
index 347a96c55..54aad578d 100644
--- a/d7/d75/postfix__evaluation_8cpp.js
+++ b/d7/d75/postfix__evaluation_8cpp.js
@@ -3,7 +3,7 @@ var postfix__evaluation_8cpp =
[ "others::postfix_expression::evaluate", "d7/d75/postfix__evaluation_8cpp.html#a19d995518723c1bc69718c3c33381e30", null ],
[ "others::postfix_expression::is_number", "d7/d75/postfix__evaluation_8cpp.html#a4c27f949c9d6659be9f5bd2ccbe1360a", null ],
[ "main", "d7/d75/postfix__evaluation_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ],
- [ "others::postfix_expression::postfix_evaluation", "d7/d75/postfix__evaluation_8cpp.html#ae38bd3a177a6d61da3859a281233bbe1", null ],
+ [ "others::postfix_expression::postfix_evaluation", "d7/d75/postfix__evaluation_8cpp.html#a55fe33d236f61f7a87548f031418bfa0", null ],
[ "test_function_1", "d7/d75/postfix__evaluation_8cpp.html#a6a8eeb7d346d5cd6335d9780fb7c0f15", null ],
[ "test_function_2", "d7/d75/postfix__evaluation_8cpp.html#a5b97d12e8b61484f756a8721992bfae1", null ]
];
\ No newline at end of file
diff --git a/d7/d75/postfix__evaluation_8cpp_source.html b/d7/d75/postfix__evaluation_8cpp_source.html
index e15e122f6..ebf354249 100644
--- a/d7/d75/postfix__evaluation_8cpp_source.html
+++ b/d7/d75/postfix__evaluation_8cpp_source.html
@@ -118,11 +118,11 @@ $(function(){initNavTree('d7/d75/postfix__evaluation_8cpp_source.html','../../',
Go to the documentation of this file.
-
-
-
-
-
+
+
+
+
+
@@ -166,77 +166,73 @@ $(function(){initNavTree('d7/d75/postfix__evaluation_8cpp_source.html','../../',
-
87template <std::
size_t N>
-
-
-
89 std::stack<float>
stack;
-
-
-
-
93 std::string scan = input[j];
-
-
-
-
-
-
-
-
+
+
+
87 std::stack<float>
stack;
+
+
89 for (
const auto &scan : input) {
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
121 std::array<std::string, 7> input = {
"2",
"3",
"1",
"*",
"+",
"9",
"-"};
-
-
-
-
125 assert(answer == -4);
-
+
+
+
+
+
+
116 std::vector<std::string> input = {
"2",
"3",
"1",
"*",
"+",
"9",
"-"};
+
+
+
+
120 assert(answer == -4);
+
-
-
-
-
134 std::array<std::string, 9> input = {
"100",
"200",
"+",
"2",
"/",
-
-
-
-
138 assert(answer == 757);
-
+
+
+
+
129 std::vector<std::string> input = {
"100",
"200",
"+",
"2",
"/",
+
+
+
+
133 assert(answer == 757);
+
-
-
141static void test_function_3() {
-
142 std::array<std::string, 43> input = {
-
143 "1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
-
144 "1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
-
145 "+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
-
146 "+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+"};
-
-
-
149 assert(answer == 22);
-
-
-
-
-
-
-
-
-
161 std::cout <<
"\nTest implementations passed!\n";
-
-
-
+
+
136static void test_function_3() {
+
137 std::vector<std::string> input = {
+
138 "1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
+
139 "1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
+
140 "+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
+
141 "+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+",
"+"};
+
+
+
144 assert(answer == 22);
+
+
+
+
+
+
+
+
+
156 std::cout <<
"\nTest implementations passed!\n";
+
+
+
for std::invalid_argument
@@ -246,10 +242,10 @@ $(function(){initNavTree('d7/d75/postfix__evaluation_8cpp_source.html','../../',
Functions for Postfix Expression algorithm.
void evaluate(float a, float b, const std::string &operation, std::stack< float > &stack)
Evaluate answer using given last two operands from and operation.
bool is_number(const std::string &s)
Checks if scanned string is a number.
-
static void test_function_2()
Test function 2 with input array {'100', '200', '+', '2', '/', '5', '*', '7', '+'}...
-
static void test_function_1()
Test function 1 with input array {'2', '3', '1', '*', '+', '9', '-'}.
-
float postfix_evaluation(std::array< std::string, N > input)
Postfix Evaluation algorithm to compute the value from given input array.
-
+
float postfix_evaluation(const std::vector< std::string > &input)
Postfix Evaluation algorithm to compute the value from given input array.
+
static void test_function_2()
Test function 2 with input array {'100', '200', '+', '2', '/', '5', '*', '7', '+'}...
+
static void test_function_1()
Test function 1 with input array {'2', '3', '1', '*', '+', '9', '-'}.
+
diff --git a/doxygen_crawl.html b/doxygen_crawl.html
index 2196e6a4f..53a730ce5 100644
--- a/doxygen_crawl.html
+++ b/doxygen_crawl.html
@@ -1484,9 +1484,9 @@
+
-
diff --git a/search/all_15.js b/search/all_15.js
index 5b43b7fe1..4597a3e04 100644
--- a/search/all_15.js
+++ b/search/all_15.js
@@ -50,7 +50,7 @@ var searchData=
['pop_5ffront_47',['pop_front',['../d8/d77/namespacemachine__learning.html#a912cf68863063a38d6e63545be5eb093',1,'machine_learning']]],
['populate_5fparents_48',['populate_parents',['../d0/d58/classgraph_1_1_rooted_tree.html#ae6928f3ebd491541e9570e746b877c1e',1,'graph::RootedTree']]],
['populate_5fup_49',['populate_up',['../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a42589cc39d6bbff6c997152f1b96e356',1,'graph::LowestCommonAncestor']]],
- ['postfix_5fevaluation_50',['postfix_evaluation',['../d7/d75/postfix__evaluation_8cpp.html#ae38bd3a177a6d61da3859a281233bbe1',1,'others::postfix_expression']]],
+ ['postfix_5fevaluation_50',['postfix_evaluation',['../d7/d75/postfix__evaluation_8cpp.html#a55fe33d236f61f7a87548f031418bfa0',1,'others::postfix_expression']]],
['postfix_5fevaluation_2ecpp_51',['postfix_evaluation.cpp',['../d7/d75/postfix__evaluation_8cpp.html',1,'']]],
['postfix_5fexpression_52',['postfix_expression',['../d4/de6/namespacepostfix__expression.html',1,'']]],
['postorder_53',['postorder',['../dd/de1/classothers_1_1recursive__tree__traversals_1_1_b_t.html#ac9404b65f407f631915515fa2e08a40c',1,'others::recursive_tree_traversals::BT']]],
diff --git a/search/functions_10.js b/search/functions_10.js
index c70623b14..c6ad40a66 100644
--- a/search/functions_10.js
+++ b/search/functions_10.js
@@ -21,7 +21,7 @@ var searchData=
['pop_5ffront_18',['pop_front',['../d8/d77/namespacemachine__learning.html#a912cf68863063a38d6e63545be5eb093',1,'machine_learning']]],
['populate_5fparents_19',['populate_parents',['../d0/d58/classgraph_1_1_rooted_tree.html#ae6928f3ebd491541e9570e746b877c1e',1,'graph::RootedTree']]],
['populate_5fup_20',['populate_up',['../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a42589cc39d6bbff6c997152f1b96e356',1,'graph::LowestCommonAncestor']]],
- ['postfix_5fevaluation_21',['postfix_evaluation',['../d7/d75/postfix__evaluation_8cpp.html#ae38bd3a177a6d61da3859a281233bbe1',1,'others::postfix_expression']]],
+ ['postfix_5fevaluation_21',['postfix_evaluation',['../d7/d75/postfix__evaluation_8cpp.html#a55fe33d236f61f7a87548f031418bfa0',1,'others::postfix_expression']]],
['postorder_22',['postorder',['../dd/de1/classothers_1_1recursive__tree__traversals_1_1_b_t.html#ac9404b65f407f631915515fa2e08a40c',1,'others::recursive_tree_traversals::BT']]],
['postorderiterative_23',['postOrderIterative',['../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a636a07c90b7f312bb86d2ec104efca25',1,'others::iterative_tree_traversals::BinaryTree']]],
['power_24',['power',['../de/dc3/fibonacci__sum_8cpp.html#a7cf5feaf168b88e74544da59ed830311',1,'math::fibonacci_sum::power()'],['../df/d72/modular__division_8cpp.html#a66cdf93153cbd1408bd74ac68961d179',1,'math::modular_division::power()'],['../dd/d47/namespacemath.html#afcd07701d73ed65cd616bcba02737f3d',1,'math::power()'],['../df/def/power__for__huge__numbers_8cpp.html#ae249a2af508aa94266023ce8aa81426f',1,'power(int x, int n): power_for_huge_numbers.cpp'],['../d7/d35/matrix__exponentiation_8cpp.html#a702a9fc90e79b05b863cc4efa26ae2ec',1,'power(const vector< vector< ll > > &A, ll p): matrix_exponentiation.cpp']]],