1.4.2 b)
● Stack
● Queue Arrays, Records, Lists, and Tuples
Arrays
An array is an ordered, finite set of elements of a single type . A 1D (one-dimensional)
array is a linear array . Unless stated in the question, arrays are always taken to be zero-
indexed. This means that the first element in the array is considered to be at position
zero. Below is an example of a one-dimensional array:
________________________________________________________________________
oneDimensionalArray = [1, 23, 12, 14, 16, 29, 12] //creates a
1D array
print(oneDimensionalArray[3])
>> 14
________________________________________________________________________
A two-dimensional array can be visualised as a table or spreadsheet . When
searching through a 2D array, you first go down the rows and then across the columns
to find a given position. This is the reverse to the method used to find a set of coordinates.
Below is an example involving a two-dimensional array.
________________________________________________________________________
twoDimensionalArray = [[123, 28, 90, 38, 88, 23, 47],[1, 23, 12,
14, 16, 29, 12]]
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller future170402. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $5.22. You're not tied to anything after your purchase.