master > master: code - minor
This commit is contained in:
parent
6541a5246d
commit
18ece75b67
code
golang/pkg
python/src/algorithms/stacks
@ -21,7 +21,7 @@ import (
|
|||||||
* ---------------------------------------------------------------- */
|
* ---------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Inputs: L = Liste von Zahlen, x = Zahl.
|
Inputs: L = Liste von Zahlen.
|
||||||
|
|
||||||
Outputs: Liste von Paaren von Elementen und ihrem nächsten größeren Element
|
Outputs: Liste von Paaren von Elementen und ihrem nächsten größeren Element
|
||||||
*/
|
*/
|
||||||
@ -42,7 +42,7 @@ func NextGreaterElement(L []int) [][2]int {
|
|||||||
element := S.TOP()
|
element := S.TOP()
|
||||||
if element < nextElement {
|
if element < nextElement {
|
||||||
// falls top Element < next Element, zum Output hinzufügen und vom Stack entfernen
|
// falls top Element < next Element, zum Output hinzufügen und vom Stack entfernen
|
||||||
logging.Debug("Stack S | %v; top Element > nextElement; ==> pop und Paar zum Output hinzufügen", S)
|
logging.Debug("Stack S | %v; top Element < nextElement; ==> pop und Paar zum Output hinzufügen", S)
|
||||||
output = append(output, [2]int{element, nextElement})
|
output = append(output, [2]int{element, nextElement})
|
||||||
S.POP()
|
S.POP()
|
||||||
metrics.AddMovesCost()
|
metrics.AddMovesCost()
|
||||||
|
@ -24,7 +24,7 @@ type QueueInt struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------- *
|
/* ---------------------------------------------------------------- *
|
||||||
* METHODS stacks
|
* METHODS queues
|
||||||
* ---------------------------------------------------------------- */
|
* ---------------------------------------------------------------- */
|
||||||
|
|
||||||
func CREATE() QueueInt {
|
func CREATE() QueueInt {
|
||||||
|
@ -37,7 +37,7 @@ def postChecks(L: List[int], **_):
|
|||||||
@algorithmInfos(name='NextGreaterElement (with stacks)', outputnames=['pairs'], preChecks=preChecks, postChecks=postChecks)
|
@algorithmInfos(name='NextGreaterElement (with stacks)', outputnames=['pairs'], preChecks=preChecks, postChecks=postChecks)
|
||||||
def NextGreaterElement(L: List[int]) -> List[Tuple[int,int]]:
|
def NextGreaterElement(L: List[int]) -> List[Tuple[int,int]]:
|
||||||
'''
|
'''
|
||||||
Inputs: L = Liste von Zahlen, x = Zahl.
|
Inputs: L = Liste von Zahlen.
|
||||||
Outputs: Liste von Paaren von Elementen und ihrem nächsten größeren Element
|
Outputs: Liste von Paaren von Elementen und ihrem nächsten größeren Element
|
||||||
'''
|
'''
|
||||||
output = [];
|
output = [];
|
||||||
@ -57,7 +57,7 @@ def NextGreaterElement(L: List[int]) -> List[Tuple[int,int]]:
|
|||||||
element = S.TOP();
|
element = S.TOP();
|
||||||
# falls element < next Element, zum Output hinzufügen und vom Stack entfernen
|
# falls element < next Element, zum Output hinzufügen und vom Stack entfernen
|
||||||
if element < nextElement:
|
if element < nextElement:
|
||||||
logDebug('Stack S | {S}; top Element > nextElement; ==> pop und Paar zum Output hinzufügen'.format(S=S))
|
logDebug('Stack S | {S}; top Element < nextElement; ==> pop und Paar zum Output hinzufügen'.format(S=S))
|
||||||
output.append((element, nextElement));
|
output.append((element, nextElement));
|
||||||
S.POP();
|
S.POP();
|
||||||
AddMovesCost();
|
AddMovesCost();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user