Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
Next Next commit
add section on time complexity
  • Loading branch information
lamafab committed Feb 27, 2023
commit 7448067862523d3e5df3c0f890fa3933c8fe9534
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ and understood. Not everything that is tested at the mid-terms or final exams is
covered and the Author does not guarantee that the cheatsheets are free of
errors.

* [Pseudocode, Vectors, Queues & Stacks](./cheatsheet_pseudocode_data_structures.pdf)
* [Pseudocode, Data Structures & Time
Complexity](./cheatsheet_pseudocode_data_structures.pdf)

# Building

Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Cheatsheet - Pseudocode, Vectors, Queues & Stacks
= Cheatsheet - Pseudocode, Data Structures & Time Complexity
Fabio Lama <[email protected]>
:description: Module: CM1015 Computational Mathematics, started 04. April 2022
:doctype: article
Expand Down Expand Up @@ -30,7 +30,9 @@ We can now call the stem:["Morning"] function:

. stem:[tt "status" larr "Morning"("TRUE", 10, 5)]

== Vector
== Data Structures

=== Vector

A **vector** is a sequentially orderer collection of elements (like an ordered
set). For example, the following vector stem:[v] is of size _three_ and
Expand All @@ -47,7 +49,7 @@ it (only replace individual items).
NOTE: In some programming languages, "vector" refers to a _growable_ collection
of data, which is very different and not the case here.

=== Operations
==== Operations

We can do operations on vectors:

Expand Down Expand Up @@ -79,7 +81,7 @@ NOTE: In programming languages, the index usually starts at stem:[0],
respectively the first element of the set is indexed at stem:[0], followed by
stem:[1, 2, ...]. In our case, we start the index at stem:[1].

== Queue
=== Queue

A **queue** is a data structure where elements need to "wait" before they get
processed. Elements the get processed in the order the elements were added,
Expand All @@ -91,7 +93,7 @@ get added to the "tail" and come out at the "head".
"new Queue " q = (A, B, C)
++++

=== Operations
==== Operations

We can do operations on queues:

Expand Down Expand Up @@ -121,12 +123,12 @@ q = (Z, A, B, C)\
"EMPTY"[q] = "false"
++++

== Stack
=== Stack

A stack is like a queue, but elements are processed in the "last in first out"
(LIFO) order.

=== Operations
==== Operations

* stem:["PUSH"\[o,s\]]: Adds element stem:[o] to the stack.
* stem:["TOP"\[s\]]: Returns the last inserted element from the stack.
Expand Down Expand Up @@ -154,3 +156,8 @@ s = (A, B, C, Z)\
s = (A, B, C)\
"EMPTY"[s] = "false"
++++

== Time Complexity

.Source: https://youtu.be/47GRtdHOKMg
image::assets/time_complexity.jpg[align=center, width=600]