⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’

Excalidraw Data

Text Elements

I = 4

I = 3

I = 0

Your array

Empty / Surface

Taking the last element And putting it in a stack

T = -1

T = 0

T = 1

T = 4

After that we keep taking one element and adding it to the stack we get this reversed Stack

`

T = -1

T = 0

T = 1

T = 4

1

2

3

4

5

5

4

3

2

1

1

Before getting confused read the indexing…

Memory Representation of Array = {1,2,3,4,5}

Take the Top Element and add it in an array in the first index.

I = 4

I = 3

I = 0

5

Memory Representation of Array = {5, … }

1

2

3

4

5

I = 4

I = 3

I = 0

{5,4,3,2,1}

Resultant Array