master > master: code go - fügte algorithmus hinzu
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
algorithm_search_jump "ads/internal/algorithms/search/jump"
|
||||
algorithm_search_poison "ads/internal/algorithms/search/poison"
|
||||
algorithm_search_sequential "ads/internal/algorithms/search/sequential"
|
||||
algorithm_stacks_next_greater_element "ads/internal/algorithms/stacks/next_greater_element"
|
||||
algorithm_sum_maxsubsum "ads/internal/algorithms/sum/maxsubsum"
|
||||
)
|
||||
|
||||
@@ -138,6 +139,13 @@ func RunNonInteractive(path string) error {
|
||||
} else {
|
||||
err_case = fmt.Errorf("Fehlende Inputs für Befehl '%[1]s'.", *problem.Command)
|
||||
}
|
||||
case "algorithm-stacks-next-greater-element":
|
||||
L := inputs.List
|
||||
if L != nil {
|
||||
_, err_case = algorithm_stacks_next_greater_element.FancyNextGreaterElement(*L)
|
||||
} else {
|
||||
err_case = fmt.Errorf("Fehlende Inputs für Befehl '%[1]s'.", *problem.Command)
|
||||
}
|
||||
case "algorithm-sum-maxsub":
|
||||
L := inputs.List
|
||||
if L != nil {
|
||||
|
||||
@@ -14,11 +14,12 @@ import (
|
||||
algorithm_search_jump "ads/internal/algorithms/search/jump"
|
||||
algorithm_search_poison "ads/internal/algorithms/search/poison"
|
||||
algorithm_search_sequential "ads/internal/algorithms/search/sequential"
|
||||
algorithm_stacks_next_greater_element "ads/internal/algorithms/stacks/next_greater_element"
|
||||
algorithm_sum_maxsubsum "ads/internal/algorithms/sum/maxsubsum"
|
||||
)
|
||||
|
||||
/* ---------------------------------------------------------------- *
|
||||
* ACTIONS - Algorithmen
|
||||
* ACTIONS algorithmen - search
|
||||
* ---------------------------------------------------------------- */
|
||||
|
||||
func actionAlgorithmSearchBinary() (bool, error) {
|
||||
@@ -202,6 +203,28 @@ func actionAlgorithmSearchSequential() (bool, error) {
|
||||
return cancel, nil
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- *
|
||||
* ACTIONS algorithmen - stacks
|
||||
* ---------------------------------------------------------------- */
|
||||
|
||||
func actionAlgorithmStacksNextGreaterElement() (bool, error) {
|
||||
input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{})
|
||||
if cancel || err != nil {
|
||||
return cancel, err
|
||||
}
|
||||
setup.DisplayStartOfCaseBlank()
|
||||
_, err = algorithm_stacks_next_greater_element.FancyNextGreaterElement(input_L)
|
||||
if err != nil {
|
||||
logging.Error(err)
|
||||
}
|
||||
setup.DisplayEndOfCase()
|
||||
return cancel, nil
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- *
|
||||
* ACTIONS algorithmen - sum
|
||||
* ---------------------------------------------------------------- */
|
||||
|
||||
func actionAlgorithmSumMaxsub() (bool, error) {
|
||||
input_L, cancel, err := promptInputListOfInt("L", "Liste von Werten", []string{})
|
||||
if cancel || err != nil {
|
||||
|
||||
@@ -27,6 +27,7 @@ var menuMain = menus.Menu{
|
||||
}, {
|
||||
{Label: "Suchalgorithmen", Submenu: &menuSearchAlgorithms},
|
||||
{Label: "Summenalgorithmen", Submenu: &menuSumAlgorithms},
|
||||
{Label: "Algorithmen mit Stacks und Queues", Submenu: &menuStacksQueuesAlgorithms},
|
||||
},
|
||||
},
|
||||
Default: -1,
|
||||
@@ -117,6 +118,19 @@ var menuSearchAlgorithms = menus.Menu{
|
||||
Default: -1,
|
||||
}
|
||||
|
||||
var menuStacksQueuesAlgorithms = menus.Menu{
|
||||
Path: []string{"Hauptmenü", "Algorithmen mit Stacks und Queues"},
|
||||
PromptMessages: []string{
|
||||
"Algorithmus wählen",
|
||||
},
|
||||
Options: [][]menus.MenuOption{
|
||||
{
|
||||
{Label: "'Next Greater Element' mit Stacks", Action: actionAlgorithmStacksNextGreaterElement},
|
||||
},
|
||||
},
|
||||
Default: -1,
|
||||
}
|
||||
|
||||
var menuSumAlgorithms = menus.Menu{
|
||||
Path: []string{"Hauptmenü", "Summenalgorithmen"},
|
||||
PromptMessages: []string{
|
||||
|
||||
Reference in New Issue
Block a user