English 中文(简体)
哪里的方括号在假编码中的回报报表中意味着什么? [闭门]
原标题:What do angle brackets mean in return-statements in pseudocode? [closed]
  • 时间:2012-05-10 09:44:54
  •  标签:
  • pseudocode

我的讲师在其课程说明中就N-Queens问题提供了一些假装。 不幸的是,我有一点时间难以理解,在 Java执行。 The pseudocode in question is:

Queens (currentBoard , currentRow, n) :
    if currentRow == n:
        if currentBoard is legal:
            return <currentBoard, 1>
        else:
            return <currentBoard, 0>
    else:
        for k = 1..n:
            newBoard = currentBoard + <currentRow+1, k>
            board [k], success[k] = Queens(newBoard, currentRow+1, n)
        kmax = index of max(success[k])
        return <board[kmax], success[kmax]>

我的理解是,但我不相信我所说的话与正文法中置于角圈的部分有关。

最佳回答

这里的方括号只是说,多个“目标”已经归还。

因此,例如,该法典

return <currentBoard, 1>

一方面,<条码>现为<<>条/代码>,另一方面是简单的<条码>1<>。

守则

board [k], success[k] = Queens(newBoard, currentRow+1, n)

您可以看到,这两种物体都储存在不同的变数中,登上<条码>>,编号为<条码>。

问题回答

暂无回答




相关问题
Pseudo codestructure to Mysql?

Can somebody help get the following pseudocode in mysql? The resulting selects in the IF statement all return the same columns (4) and multiple rows (unknown) so that s not really the problem i m ...

Assembler Language Programming

I am trying to write a program that inputs a positive number less than 10 and outputs the sum of the first numbers. For example 5 would be 5+4+3+2+1. The commands are Stop, Load, Store, Add, Sum, ...

Job scheduling problem

I m working on an application where I need to automatically schedule jobs for members on a rotating schedule. I m not very good at explaining rules, so here s some data to help out: Positions: A job ...

Explain this DSP notation

I m trying to implement this extenstion of the Karplus-Strong plucked string algorithm, but I don t understand the notation there used. Maybe it will take years of study, but maybe it won t - maybe ...

Pseudocode for getting order based on Dependency

Ok, my situation is this I have a list of items and I need to get the order of these items based on the references they have. For example lets say we have these items: A,B,C,D,E,F C and D have no ...

热门标签