Skip to content

GH-199: Array in C++ #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update
  • Loading branch information
rain1024 committed Mar 15, 2023
commit c752cba8fc5efef7cf1aa5ea08e6de123666203b
8 changes: 4 additions & 4 deletions concepts/cpp/array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In computer science, an `array` is a data structure consisting of a collection o
using namespace std;
```

**Initialize an array**
**Initialization**: Create an array with given values


```c++
Expand All @@ -34,7 +34,7 @@ a



**Access element by index (zero-based)**
**Accessing Elements**: Access element by index (zero-based)


```c++
Expand All @@ -47,7 +47,7 @@ cout << "a[2] = " << a[2] << endl;
a[2] = 3


**Set value of an element at a given index**
**Updating Elements**: Update an element by its index


```c++
Expand All @@ -57,7 +57,7 @@ cout << "a[0] = " << a[0];

a[0] = 100

**Read array from input stream**
**Input**: Read values into the array from a stream

Using fixed array

Expand Down
8 changes: 4 additions & 4 deletions concepts/cpp/array/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Initialize an array**"
"**Initialization**: Create an array with given values"
]
},
{
Expand Down Expand Up @@ -80,7 +80,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Access element by index (zero-based)**"
"**Accessing Elements**: Access element by index (zero-based)"
]
},
{
Expand Down Expand Up @@ -111,7 +111,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Set value of an element at a given index**"
"**Updating Elements**: Update an element by its index"
]
},
{
Expand Down Expand Up @@ -140,7 +140,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Read array from input stream**\n",
"**Input**: Read values into the array from a stream\n",
"\n",
"Using fixed array \n",
"\n",
Expand Down
14 changes: 8 additions & 6 deletions concepts/general/array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ In competive programming, arrays are often used to store a list of values. For e

## Array Operations

Basic operations:

* `array.length`: Returns the number of elements in the array.
* `array[index]`: Returns the element at the given index.
* `array[index] = value`: Sets value of an element at a given index
* Read array from input stream
Here are some basic operations that you can perform on arrays:

* Initialization: Create an array with given values
* Accessing Elements: Access an element by its index (zero-based)
* Updating Elements: Update an element by its index
* Traversal: Visit all elements of the array
* Input: Read values into the array from a stream
* Size: Get the number of elements in the array

More operations:

Expand Down