Skip to content

Commit

Permalink
restructure directories and add dsa-based games section
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamankoji committed Oct 17, 2024
1 parent 589b7d4 commit 66ecd34
Show file tree
Hide file tree
Showing 63 changed files with 129 additions and 139 deletions.
File renamed without changes.
File renamed without changes
60 changes: 0 additions & 60 deletions C++/Data_Structures/Sorting Algorithms/Quick-Sort.c++

This file was deleted.

66 changes: 36 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,55 @@
Thank you for considering contributing to this repository! Here are some ways you can contribute:

## 1. Documentation Improvement
- Enhance the README file by correcting grammar and syntax errors.
- Improve the structure and layout of the content.
- Write the same structure present in the README file in Java, JavaScript, Python, or any other language.

- Enhance the README file by correcting grammar and syntax errors.
- Improve the structure and layout of the content.
- Write the same structure present in the README file in Java, JavaScript, Python, or any other language.

## 2. Share Resources
- Link resources to cover missed topics in the README content.
- Provide additional resources with content.
- Add more useful content.

- Link resources to cover missed topics in the README content.
- Provide additional resources with content.
- Add more useful content.

## 3. Code Contribution
- Add files implementing data structures (insertion, deletion, searching).
- Include conceptual implementation codes in C, C++, Java, Python, or any other language of your choice.
- Respective Algorithms implementation

- Add files implementing data structures (insertion, deletion, searching).
- Include conceptual implementation codes in C, C++, Java, Python, or any other language of your choice.
- Respective Algorithms implementation

**Important**: Make any of the above changes in an organized and proper structure.

**Note**: You can add your own content if you wish.

## Code Contribution Folder Structure

# Code Contribution Folder Structure
### For Data Structures Code Folders

## For Data Structures Code Folders
Example:
* JavaScript-DSA `(folder)`
* 01-Introduction `(folder)`
* 02-Data-Structures `(folder)`
* Linked-List `(folder)`
* Operations `(folder)`
* Singly-Linked-List `(folder)`
- insertion.js or insertion.md `(file)`
- deletion.js or deletion.md `(file)`
* Doubly-Linked-List
- insertion.js or insertion.md `(file)`
- deletion.js or deletion.md `(file)`

## For Algorithms Code Folders

- JavaScript-DSA `(folder)`
- 01-Introduction `(folder)`
- 02-Data-Structures `(folder)`
- Linked-List `(folder)`
- Operations `(folder)`
- Singly-Linked-List `(folder)`
- insertion.js or insertion.md `(file)`
- deletion.js or deletion.md `(file)`
- Doubly-Linked-List
- insertion.js or insertion.md `(file)`
- deletion.js or deletion.md `(file)`

### For Algorithms Code Folders

Example:
* 03-Algorithms
* Greedy Method `(folder)`
* Fractional-Knapsack-Problem.cpp `(file)`
* Recursion `(folder)`
* Divide and Conquer `(folder)`

- 03-Algorithms
- Greedy Method `(folder)`
- Fractional-Knapsack-Problem.cpp `(file)`
- Recursion `(folder)`
- Divide and Conquer `(folder)`

Thanks! :heart: :heart: :heart:

SERVER-X Team
SERVERX Team
15 changes: 0 additions & 15 deletions JavaScript/02 - Data-Structures/01 - Array/03 - Resources.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,57 +1,68 @@
# Introduction to Arrays in JavaScript

An array in JavaScript or in General is a versatile and fundamental data structure that allows the storage of multiple values within a single variable. It provides a way to organize and access elements through a numerical index or key. Arrays in JavaScript can hold a mix of data types, including numbers, strings, objects, or even other arrays.

## Table of Index

| Index | Topic |
|-------|-----------------------|
| 1 | Introduction |
| 2 | Operations related to Arrays in Javascript |
| Index | Topic |
| ----- | --------------------------------------------------- |
| 1 | Introduction |
| 2 | Operations related to Arrays in Javascript |
| 3 | Resources to learn and Practice Arrays in Javascipt |

## Basic Operations of Arrays in JavaScript

Arrays in JavaScript support a variety of operations that allow for efficient manipulation and retrieval of elements. Here are some basic operations:

### 1. **Declaration and Initialization:**
- Create an array and initialize it with elements.

- Create an array and initialize it with elements.

## 2. **Accessing Elements:**
- Access elements by their index.
- Negative indexing to access elements from the end.

- Access elements by their index.
- Negative indexing to access elements from the end.

### 3. **Updating Elements:**
- Modify the value of an element at a specific index.

- Modify the value of an element at a specific index.

### 4. **Adding Elements:**
- **Push:** Add an element to the end of the array.
- **Unshift:** Add an element to the beginning of the array.
- **Splice:** Add elements at a specific index.

- **Push:** Add an element to the end of the array.
- **Unshift:** Add an element to the beginning of the array.
- **Splice:** Add elements at a specific index.

### 5. **Removing Elements:**
- **Pop:** Remove the last element of the array.
- **Shift:** Remove the first element of the array.
- **Splice:** Remove elements from a specific index.

- **Pop:** Remove the last element of the array.
- **Shift:** Remove the first element of the array.
- **Splice:** Remove elements from a specific index.

### 6. **Concatenation:**
- Combine two or more arrays to create a new array.

- Combine two or more arrays to create a new array.

### 7. **Slicing:**
- Extract a portion of the array to create a new array.

- Extract a portion of the array to create a new array.

### 8. **Searching:**
- **IndexOf:** Find the index of a specific element.
- **Includes:** Check if an array contains a specific element.

- **IndexOf:** Find the index of a specific element.
- **Includes:** Check if an array contains a specific element.

### 9. **Sorting:**
- **Sort:** Arrange the elements in ascending or descending order.

- **Sort:** Arrange the elements in ascending or descending order.

### 10. **Iterating:**
- Use loops or higher-order functions like forEach, map, filter, and reduce to iterate through elements.

- Use loops or higher-order functions like forEach, map, filter, and reduce to iterate through elements.

### 11. **Length:**
- Access the `length` property to determine the number of elements in the array.

- Access the `length` property to determine the number of elements in the array.

## Conclution

Expand Down
Original file line number Diff line number Diff line change
@@ -1,67 +1,95 @@
# Basic Operations of Arrays in JavaScript

## 1. **Declaration and Initialization:**
- Create an array and initialize it with elements.

```javascript
- Create an array and initialize it with elements.

```javascript
let fruits = ['apple', 'orange', 'banana'];
```
## 2. Accessing Elements:

## 2. Accessing Elements

- Access elements by their index.
- Negative indexing to access elements from the end.

```javascript
let firstFruit = fruits[0]; // Access the first element
let lastFruit = fruits[fruits.length - 1]; // Access the last element using negative indexing
```
## 3. Updating Elements:

## 3. Updating Elements

- Modify the value of an element at a specific index.

```javascript
fruits[1] = 'grape'; // Update the second element
```
# 4. Adding Elements:

# 4. Adding Elements

- Push: Add an element to the end of the array.
- Unshift: Add an element to the beginning of the array.
- Splice: Add elements at a specific index.

``` javascript
fruits.push('kiwi'); // Add 'kiwi' to the end
fruits.unshift('pineapple'); // Add 'pineapple' to the beginning
fruits.splice(2, 0, 'lemon'); // Add 'lemon' at index 2
```
## 5. Removing Elements:

## 5. Removing Elements

- Pop: Remove the last element of the array.
- Shift: Remove the first element of the array.
- Splice: Remove elements from a specific index.

```javascript
let removedLast = fruits.pop(); // Remove and return the last element
let removedFirst = fruits.shift(); // Remove and return the first element
let removedAtIndex = fruits.splice(1, 2); // Remove 2 elements starting from index 1
```
## 6. Concatenation:

## 6. Concatenation

- Combine two or more arrays to create a new array.

```javascript
let moreFruits = ['mango', 'pear'];
let combinedArray = fruits.concat(moreFruits);
```
## 7. Slicing:

## 7. Slicing

- Extract a portion of the array to create a new array.

```javascript
let slicedArray = fruits.slice(1, 3); // Extract elements from index 1 to 2
```
## 8. Searching:

## 8. Searching

- IndexOf: Find the index of a specific element.
- Includes: Check if an array contains a specific element.

```javascript
let indexOfBanana = fruits.indexOf('banana'); // Returns the index of 'banana'
let includesMango = fruits.includes('mango'); // Returns true if 'mango' is present
```
## 9. Sorting:

## 9. Sorting

- Sort: Arrange the elements in ascending or descending order.

```javascript
fruits.sort(); // Sort elements in ascending order
fruits.reverse(); // Reverse the order of elements
```
## 10. Iterating:

## 10. Iterating

- Use loops or higher-order functions like `forEach`, `map`, `filter`, and `reduce` to iterate through elements.

```javascript
// Using forEach
fruits.forEach(fruit => {
Expand All @@ -71,10 +99,15 @@ fruits.forEach(fruit => {
// Using map
let upperCaseFruits = fruits.map(fruit => fruit.toUpperCase());
```
## 11. Length:

## 11. Length

- Access the `length` property to determine the number of elements in the array.

```javascript
let arrayLength = fruits.length; // Returns the number of elements in the array
```

# Conclution
These concepts provide a foundational understanding of array operations in JavaScript. Feel free to use and modify these examples for your projects.

These concepts provide a foundational understanding of array operations in JavaScript. Feel free to use and modify these examples for your projects.
15 changes: 15 additions & 0 deletions JavaScript/Data-Structures/01-arrays/02-Resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Resources to Learn Arrays in JavaScript

| Type | Title | Author/Instructor | Link |
| ------------ | --------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------------------------------------- |
| **Books** | "JavaScript: The Good Parts" | Douglas Crockford | [Amazon](https://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742) |
| | "Eloquent JavaScript" | Marijn Haverbeke | [Eloquent JavaScript](https://eloquentjavascript.net/) |
| | "You Don't Know JS - Scope & Closures" | Kyle Simpson | [GitHub](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/README.md) |
| **Websites** | Mozilla Developer Network (MDN) | Mozilla | [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Indexed_collections) |
| | W3Schools | W3Schools | [W3Schools JavaScript Arrays](https://www.w3schools.com/js/js_arrays.asp) |
| | GeeksforGeeks | GeeksforGeeks | [GeeksforGeeks JavaScript Arrays](https://www.geeksforgeeks.org/javascript-array/) |
| **YouTube** | "JavaScript Arrays - Beau teaches JavaScript" | Traversy Media | [YouTube Playlist](https://www.youtube.com/playlist?list=PLillGF-RfqbaEmlPcX5e_ejaK7Y5MydkW) |
| | "JavaScript Tutorial for Beginners: Learn JavaScript in 1 Hour" | Programming with Mosh | [YouTube](https://www.youtube.com/watch?v=W6NZfCO5SIk) |
| | "JavaScript Arrays Explained" | Programming with Mosh | [YouTube](https://www.youtube.com/watch?v=oigfaZ5ApsM) |

These resources cover a variety of formats, including books, websites, and YouTube playlists, offering different learning experiences. Choose the ones that best fit your learning preferences and level of expertise.
Empty file added games-based-on-dsa/.gitkeep
Empty file.

0 comments on commit 66ecd34

Please sign in to comment.