Subtopic Notes

G - Arrays

Preq. Programming Basics

Arrays

  • Stores a collection of elements of the same data type
  • Contiguous block of memory
  • Widely used in programming because they allow efficient access and manipulation of a large number of values
  • Elements can be accessed using index
  • Advantages: Fast insertion, Fast access of elements
  • Disadvantages: Slow search, Slow deletion, Fixed size
  • Ordered Arrays: Elements are arranged in a specific order based on values
    • Advantage: More efficient search algorithm
    • Disadvantage: Slow deletion, slow insertion, fixed size
  • Arrays are 0 indexed: Index of 1st element is 0, 2nd element is 1
  • Index of last element: length - 1
  • In Pseudocode, Arrays index might start from 0 or 1

PYTHON

Python can be executed directly in the browser.

Editor — Python
Output
No output yet.

PSEUDOCODE

Pseudocode uses basic Cambridge-style keyword highlighting. Execution is not supported yet.

Editor — Pseudocode

Common Array Operations

PYTHON

Python can be executed directly in the browser.

Editor — Python
Output
No output yet.

PSEUDOCODE

Pseudocode uses basic Cambridge-style keyword highlighting. Execution is not supported yet.

Editor — Pseudocode