Skip to content

Clarify using matrices and tables #480

@wojtask

Description

@wojtask

Sometimes CLRS pseudocodes create empty matrices or tables (2D arrays):

  • "let D be a new n\times n matrix" (page 772)
  • "let m[1\subarr n, 1\subarr n] be a new table" (page 391)

Table elements are accessed using pairs of indices, e.g., m[i,j]. Matrix elements are accessed using lowercase letters with a pair of subscripts, e.g., d_{ij}.

We have a translation rule "let A[1\subarr n] be a new array" -> A = Array(1, n), and "A[i]" -> A[i].

Clarify how to translate the above examples. Explicitly add new translation rules for creation and accessors. Do we need a new Table type to encapsulate an Array of Arrays?

Moreover, sometimes arrays are also accessed with lowercase letters with a pair of subscripts, e.g., a_i. Do we need an explicit translation rule for it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions