master > master: code, go - bugs behoben (out of bounds + Konversion fand nicht statt)
This commit is contained in:
parent
d6bc4b9d72
commit
1a387ac308
@ -38,6 +38,9 @@ func JumpSearchLinear(L []int, x int, m int) int {
|
|||||||
// ACHTUNG: dies ist eine while-Schleife ist golang:
|
// ACHTUNG: dies ist eine while-Schleife ist golang:
|
||||||
for i0 < len(L) {
|
for i0 < len(L) {
|
||||||
metrics.AddTimeCost()
|
metrics.AddTimeCost()
|
||||||
|
if i1 > len(L) {
|
||||||
|
i1 = len(L)
|
||||||
|
}
|
||||||
block := L[i0:i1]
|
block := L[i0:i1]
|
||||||
elementAfterBlock := block[len(block)-1] + 1
|
elementAfterBlock := block[len(block)-1] + 1
|
||||||
if x < elementAfterBlock {
|
if x < elementAfterBlock {
|
||||||
@ -74,6 +77,9 @@ func JumpSearchExponentiell(L []int, x int) int {
|
|||||||
// ACHTUNG: dies ist eine while-Schleife ist golang:
|
// ACHTUNG: dies ist eine while-Schleife ist golang:
|
||||||
for i0 < len(L) {
|
for i0 < len(L) {
|
||||||
metrics.AddTimeCost()
|
metrics.AddTimeCost()
|
||||||
|
if i1 > len(L) {
|
||||||
|
i1 = len(L)
|
||||||
|
}
|
||||||
block := L[i0:i1]
|
block := L[i0:i1]
|
||||||
elementAfterBlock := block[len(block)-1] + 1
|
elementAfterBlock := block[len(block)-1] + 1
|
||||||
if x < elementAfterBlock {
|
if x < elementAfterBlock {
|
||||||
|
@ -463,8 +463,8 @@ func PromptInputListOfZeroOnes(name string, descr string, requirements []string)
|
|||||||
Response: &response,
|
Response: &response,
|
||||||
}
|
}
|
||||||
cancel, err := query.Prompt()
|
cancel, err := query.Prompt()
|
||||||
// konvertiere in int
|
// uint8 -> int
|
||||||
if !cancel && err != nil {
|
if response.Response != nil {
|
||||||
for _, x := range response.Response {
|
for _, x := range response.Response {
|
||||||
values = append(values, int(x))
|
values = append(values, int(x))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user