Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion de/arrays/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ autos[0] = "Opel"; // Ändern des ersten Elements eines Arrays
console.log(autos);
// Ergebnis: ['Opel', 'Volvo', 'BMW']
```
{% hint style="warning" %}
{% hint style="working" %}
Arrays sind eine spezielle Art von Objekt. Es können Objekte in einem Array vorhanden sein.
{% endhint %}

Expand Down
2 changes: 1 addition & 1 deletion de/arrays/for-each.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ zahlen.forEach(zahl => console.log(zahl * 2));

Die `forEach`-Methode ändert nicht das ursprüngliche Array. Sie durchläuft lediglich die Elemente des Arrays und führt die bereitgestellte Funktion für jedes Element aus.

{% hint style="warning" %}
{% hint style="working" %}
Die `forEach()`-Methode wird nicht für die leere Anweisung ausgeführt.
{% endhint %}
```
2 changes: 1 addition & 1 deletion de/arrays/join.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ console.log(array.join(" "));
// Ergebnis: eins zwei drei vier
```

{% hint style="warning" %}
{% hint style="working" %}
Es kann ein beliebiges Trennzeichen angegeben werden, aber das Standardtrennzeichen ist ein Komma `(,)`.
{% endhint %}

Expand Down
2 changes: 1 addition & 1 deletion de/arrays/pop.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ while (array.length > 0) {
console.log(array); // Ergebnis: []
```

{% hint style="warning" %}
{% hint style="working" %}
Die "pop"-Methode funktioniert nur bei Arrays und nicht bei anderen Objekten, die Arrays ähneln, wie z.B. Argument-Objekten oder NodeList-Objekten. Wenn Sie Elemente aus einem dieser Arten von Objekten entfernen müssen, müssen Sie es zuerst in ein Array umwandeln, indem Sie die Methode Array.prototype.slice() verwenden.

{% endhint %}
2 changes: 1 addition & 1 deletion de/arrays/shift.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ while (array.length > 0) {
console.log(array); // Ergebnis: []
```

{% hint style="warning" %}
{% hint style="working" %}
Die "shift"-Methode funktioniert nur bei Arrays und nicht bei anderen Objekten, die Arrays ähneln, wie zum Beispiel Argument-Objekten oder NodeList-Objekten. Wenn Sie Elemente aus einem dieser Arten von Objekten verschieben müssen, müssen Sie es zuerst in ein Array umwandeln, indem Sie die Methode Array.prototype.slice() verwenden.
{% endhint %}
2 changes: 1 addition & 1 deletion de/arrays/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ punkte.sort((a, b) => {return a-b});
// Ergebnis: [1, 5, 10, 25, 40, 100]
```

{% hint style="warning" %}
{% hint style="working" %}
Die sort()-Methode überschreibt das ursprüngliche Array.
{% endhint %}
2 changes: 1 addition & 1 deletion de/arrays/spread.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ console.log(arr); // Ergebnis: [1, 2, 3, 4, 5, 6, 7]

```

{% hint style="warning" %}
{% hint style="working" %}
Der Spread-Operator funktioniert nur in modernen Browsern, die diese Funktion unterstützen. Wenn Sie ältere Browser unterstützen müssen, müssen Sie einen Transpiler wie Babel verwenden, um die Syntax des Spread-Operators in äquivalenten ES5-Code umzuwandeln.
{% endhint %}
2 changes: 1 addition & 1 deletion de/arrays/unshift.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ array.unshift(-5); // 4

// ERGEBNIS: array = [-5 , 0, 5, 10];
```
{% hint style="warning" %}
{% hint style="working" %}
Die Methode unshift() überschreibt das ursprüngliche Array.
{% endhint %}

Expand Down
2 changes: 1 addition & 1 deletion de/date-and-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ new Date(year,month,day,hours,minutes,seconds,ms)
new Date(milliseconds)
```

{% hint style="warning" %}
{% hint style="working" %}
Monate können von `0` bis `11` angegeben werden, darüber hinaus erfolgt ein Überlauf in das nächste Jahr.
{% endhint %}

Expand Down
2 changes: 1 addition & 1 deletion de/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const age = 30;
export {name, age};
```

{% hint style="warning" %}
{% hint style="working" %}
Eine Datei darf nur einen einzigen Standard-`export` enthalten.
{% endhint %}

Expand Down
2 changes: 1 addition & 1 deletion de/regular-expression.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Eigenschaften und Methoden, die von RegEx unterstützt werden:
| `test()` | Testet, ob ein Treffer existiert, und gibt `true` oder `false` zurück |
| `toString()` | Gibt das Muster als Zeichenkette zurück |

{% hint style="warning" %}
{% hint style="working" %}
Eine `compile()` Methode zum Kompilieren eines regulären Ausdrucks ist veraltet. Sie war früher nützlich, um bestehende RegEx-Objekte neu zu konfigurieren, ist aber heute durch direktes Neuerstellen überflüssig.
{% endhint %}

Expand Down
24 changes: 12 additions & 12 deletions en/Dedication.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
pageNumber: I
chapter:
---
# Dedication
This book is dedicated, in respect and admiration, to the spirit of computers and programming languages in our world.
> “The art of programming is the art of organizing complexity, of mastering multitude and avoiding its bastard chaos as effectively as possible.”
>
> -  Edsger Dijkstra
---
pageNumber: I
chapter:
---
# Dedication

This book is dedicated, in respect and admiration, to the spirit of computers and programming languages in our world.


> “The art of programming is the art of organizing complexity, of mastering multitude and avoiding its bastard chaos as effectively as possible.”
>
> -  Edsger Dijkstra
2 changes: 1 addition & 1 deletion en/arrays/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ console.log(cars);
// Result: ['Opel', 'Volvo', 'BMW']
```

{% hint style="warning" %}
{% hint style="working" %}
Arrays are a special type of object. One can have [objects](../objects/) in an array.
{% endhint %}

Expand Down
2 changes: 1 addition & 1 deletion en/arrays/for-each.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ numbers.forEach(number => console.log(number * 2));

The `forEach` method does not modify the original array. It simply iterates over the elements of the array and executes the provided function for each element.

{% hint style="warning" %}
{% hint style="working" %}
The `forEach()` method is not executed for the empty statement.
{% endhint %}
2 changes: 1 addition & 1 deletion en/arrays/join.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ console.log(array.join(" "));
// Result: one two three four
```

{% hint style="warning" %}
{% hint style="working" %}
Any separator can be specified but the default one is a comma `(,)`.
{% endhint %}

Expand Down
2 changes: 1 addition & 1 deletion en/arrays/pop.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ while (array.length > 0) {
console.log(array); // Result: []
```

{% hint style="warning" %}
{% hint style="working" %}
The `pop` method only works on arrays, and not on other objects that are similar to arrays such as arguments objects or NodeList objects. If you need to pop elements from one of these types of objects, you will need to convert it to an array first using the `Array.prototype.slice()` method.

{% endhint %}
2 changes: 1 addition & 1 deletion en/arrays/shift.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ while (array.length > 0) {
console.log(array); // Result: []
```

{% hint style="warning" %}
{% hint style="working" %}
The `shift` method only works on arrays, and not on other objects that are similar to arrays such as arguments objects or NodeList objects. If you need to shift elements from one of these types of objects, you will need to convert it to an array first using the `Array.prototype.slice()` method.
{% endhint %}
2 changes: 1 addition & 1 deletion en/arrays/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ points.sort((a, b) => {return a-b});
// Result: [1, 5, 10, 25, 40, 100]
```

{% hint style="warning" %}
{% hint style="working" %}
The `sort()` method overrides the original array.
{% endhint %}
2 changes: 1 addition & 1 deletion en/arrays/spread.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ console.log(arr); //Result: [1, 2, 3, 4, 5, 6, 7]

```

{% hint style="warning" %}
{% hint style="working" %}
The spread operator only works in modern browsers that support the feature. If you need to support older browsers, you will need to use a transpiler like Babel to convert the spread operator syntax to equivalent ES5 code.
{% endhint %}
2 changes: 1 addition & 1 deletion en/arrays/unshift.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ array.unshift(-5); // 4
// RESULT: array = [-5 , 0, 5, 10];
```

{% hint style="warning" %}
{% hint style="working" %}
The `unshift()` method overwrites the original array.
{% endhint %}

Expand Down
145 changes: 72 additions & 73 deletions en/complexity/space-complexity.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,72 @@
---
chapter: 8
pageNumber: 55
description: This chapter explains space complexity, which measures the memory usage of an algorithm relative to the input size. It includes examples in JavaScript to illustrate how different algorithms use memory. The focus is on understanding how the memory requirements change with varying input sizes.
---

# Space Complexity

Space complexity is the amount of memory that a program takes to run with respect to the size of the input.

In this chapter, we will learn about the following space complexities:

- O(n) - linear space complexity
- O(n^2) - quadratic space complexity
- O(1) - constant space complexity

### **Linear Space Complexity: O(n)**
An algorithm has a linear space complexity if the amount of memory required to execute is proportional to the size of the input.

**Example:**
```javascript
function squareElements(arr) {
const result = [];
for (let i = 0; i < arr.length; i++) {
result.push(arr[i] * arr[i]);
}
return result;
}

const myArray = [1, 2, 3, 4, 5];
console.log(squareElements(myArray)); // Output: [1, 4, 9, 16, 25]
```
In this example, the space complexity is O(n) because the result array grows in proportion to the size of the input array `arr`.


### Quadratic Space Complexity (O(n^2))
The memory required grows proportionally to the square of the input size.

**Example:**
```javascript
function createMatrix(n) {
const matrix = [];
for (let i = 0; i < n; i++) {
matrix[i] = [];
for (let j = 0; j < n; j++) {
matrix[i][j] = i + j;
}
}
return matrix;
}

const matrix = createMatrix(3);
console.log(matrix); // Output: [[0, 1, 2], [1, 2, 3], [2, 3, 4]]
```

The space required grows quadratically with the input size `n`.


### **Constant Space Complexity (O(1))**
The memory required remains the same regardless of the input size.

**Example:**
```javascript
function printCube(num) {
const result = num * num * num;
console.log(result);
}

printCube(3); // Output: 27
```

The space required does not depend on the input size.

---
chapter: 8
pageNumber: 55
description: This chapter explains space complexity, which measures the memory usage of an algorithm relative to the input size. It includes examples in JavaScript to illustrate how different algorithms use memory. The focus is on understanding how the memory requirements change with varying input sizes.
---

# Space Complexity

Space complexity is the amount of memory that a program takes to run with respect to the size of the input.

In this chapter, we will learn about the following space complexities:

- O(n) - linear space complexity
- O(n^2) - quadratic space complexity
- O(1) - constant space complexity

### **Linear Space Complexity: O(n)**
An algorithm has a linear space complexity if the amount of memory required to execute is proportional to the size of the input.

**Example:**
```javascript
function squareElements(arr) {
const result = [];
for (let i = 0; i < arr.length; i++) {
result.push(arr[i] * arr[i]);
}
return result;
}

const myArray = [1, 2, 3, 4, 5];
console.log(squareElements(myArray)); // Output: [1, 4, 9, 16, 25]
```
In this example, the space complexity is O(n) because the result array grows in proportion to the size of the input array `arr`.


### **Quadratic Space Complexity: O(n^2)**
The memory required grows proportionally to the square of the input size.

**Example:**
```javascript
function createMatrix(n) {
const matrix = [];
for (let i = 0; i < n; i++) {
matrix[i] = [];
for (let j = 0; j < n; j++) {
matrix[i][j] = i + j;
}
}
return matrix;
}

const matrix = createMatrix(3);
console.log(matrix); // Output: [[0, 1, 2], [1, 2, 3], [2, 3, 4]]
```

The space required grows quadratically with the input size `n`.


### **Constant Space Complexity: O(1)**
The memory required remains the same regardless of the input size.

**Example:**
```javascript
function printCube(num) {
const result = num * num * num;
console.log(result);
}

printCube(3); // Output: 27
```

The space required does not depend on the input size.
Loading
Loading