-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
616 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Bash Directory | ||
|
||
This directory contains code examples written in Bash. Bash is a Unix shell and command language that is widely used for scripting and automation. | ||
|
||
## Code Examples | ||
|
||
### 1. Hello World | ||
|
||
The `hello-world.sh` script prints "Hello, World!" to the console. | ||
|
||
```bash | ||
# Hello World in Bash | ||
|
||
echo "Hello, World!" | ||
``` | ||
|
||
## Contributing | ||
|
||
If you would like to contribute to this directory, please follow the guidelines outlined in the `CONTRIBUTING.md` file in the root directory of this repository. | ||
|
||
## License | ||
|
||
This directory is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# C# Directory | ||
|
||
This directory contains C# programs. Below is a brief description of each file: | ||
|
||
## Files | ||
|
||
- `hello-world.cs`: A simple "Hello, World!" program in C#. | ||
|
||
## How to Compile and Run | ||
|
||
To compile and run any of the C# programs, use the following commands: | ||
|
||
```sh | ||
csc filename.cs | ||
mono filename.exe | ||
``` | ||
|
||
Replace `filename.cs` with the name of the C# file you want to compile. | ||
|
||
## Contribution Guidelines | ||
|
||
Feel free to add more C# programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# C++ Directory | ||
|
||
This directory contains C++ code examples and algorithms. Each file demonstrates a specific concept or algorithm in C++. | ||
|
||
## List of Files | ||
|
||
- `binarySearch.cpp`: Implementation of binary search algorithm. | ||
- `CP-template.cpp`: A template for competitive programming in C++. | ||
- `hello-world.cpp`: A simple "Hello, World!" program in C++. | ||
- `primes.cpp`: Program to calculate prime numbers in a given range. | ||
- `segmentTreeForSum.cpp`: Implementation of a segment tree for sum queries. | ||
|
||
## How to Run the Code | ||
|
||
To compile and run any of the C++ programs, use the following commands: | ||
|
||
```bash | ||
g++ -o output filename.cpp | ||
./output | ||
``` | ||
|
||
Replace `filename.cpp` with the name of the file you want to compile and run. | ||
|
||
## Contributing | ||
|
||
If you have any C++ code examples or algorithms that you would like to add to this directory, please follow the contribution guidelines in the main `README.md` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# C Directory | ||
|
||
This directory contains C programs. Below is a brief description of each file: | ||
|
||
## Files | ||
|
||
- `bubblesort.c`: Implementation of the Bubble Sort algorithm. | ||
- `checkPrime.c`: Program to check for prime numbers. | ||
- `hello-world.c`: A simple "Hello, World!" program in C. | ||
- `insertionSort.c`: Implementation of the Insertion Sort algorithm. | ||
|
||
## How to Compile and Run | ||
|
||
To compile and run any of the C programs, use the following commands: | ||
|
||
```sh | ||
gcc filename.c -o outputfile | ||
./outputfile | ||
``` | ||
|
||
Replace `filename.c` with the name of the C file you want to compile, and `outputfile` with the desired name of the executable. | ||
|
||
## Contribution Guidelines | ||
|
||
Feel free to add more C programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Dart Directory | ||
|
||
This directory contains code examples written in Dart. Dart is a client-optimized language for fast apps on any platform. | ||
|
||
## Code Examples | ||
|
||
### 1. Hello World | ||
|
||
The `hello-world.dart` script prints "Hello, World!" to the console. | ||
|
||
```dart | ||
void main() { | ||
print('Hello, World!'); | ||
} | ||
``` | ||
|
||
## Contributing | ||
|
||
If you would like to contribute to this directory, please follow the guidelines outlined in the `CONTRIBUTING.md` file in the root directory of this repository. | ||
|
||
## License | ||
|
||
This directory is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Fortran Directory | ||
|
||
This directory contains Fortran programs. Below is a brief description of each file: | ||
|
||
## Files | ||
|
||
- `hello-world.f`: A simple "Hello, World!" program in Fortran. | ||
|
||
## How to Compile and Run | ||
|
||
To compile and run any of the Fortran programs, use the following commands: | ||
|
||
```sh | ||
gfortran filename.f -o outputfile | ||
./outputfile | ||
``` | ||
|
||
Replace `filename.f` with the name of the Fortran file you want to compile, and `outputfile` with the desired name of the executable. | ||
|
||
## Contribution Guidelines | ||
|
||
Feel free to add more Fortran programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Java Directory | ||
|
||
This directory contains Java programs demonstrating various algorithms and data structures. Each file is a self-contained example of a specific algorithm or data structure. | ||
|
||
## List of Programs | ||
|
||
1. `BinarySearch.java`: Implementation of the binary search algorithm. | ||
2. `BubbleSort.java`: Implementation of the bubble sort algorithm. | ||
3. `HelloWorld.java`: A simple program that prints "Hello World!". | ||
4. `insertionSort.java`: Implementation of the insertion sort algorithm. | ||
5. `InterpolationSearch.java`: Implementation of the interpolation search algorithm. | ||
|
||
## How to Run | ||
|
||
To run any of the Java programs in this directory, follow these steps: | ||
|
||
1. Open a terminal or command prompt. | ||
2. Navigate to the directory containing the Java file you want to run. | ||
3. Compile the Java file using the `javac` command. For example, to compile `HelloWorld.java`, run: | ||
```bash | ||
javac HelloWorld.java | ||
``` | ||
4. Run the compiled Java program using the `java` command. For example, to run `HelloWorld`, run: | ||
```bash | ||
java HelloWorld | ||
``` | ||
|
||
## Contribution Guidelines | ||
|
||
If you would like to contribute to this directory, please follow these guidelines: | ||
|
||
1. Ensure your code is well-documented and follows the coding standards. | ||
2. Add a brief description of your program in this `README.md` file. | ||
3. Ensure your program is placed in the correct directory. | ||
4. Test your program thoroughly before submitting a pull request. | ||
|
||
Thank you for your contributions! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# JavaScript Directory | ||
|
||
This directory contains JavaScript code examples and utilities. Below is a brief description of each file in this directory. | ||
|
||
## Files | ||
|
||
### `Debounce.js` | ||
- **Description**: A debounce function in JavaScript limits how often a given function can be called in quick succession. This is particularly useful when handling events like scroll or resize, where frequent firing can impact performance. | ||
- **Usage**: The `debounce` function takes two arguments: the function to debounce and the delay in milliseconds. It returns a debounced version of the function. | ||
- **Example**: | ||
```javascript | ||
const logMessage = (message) => { | ||
console.log(message); | ||
}; | ||
const debouncedLog = debounce(logMessage, 300); | ||
debouncedLog('Hello'); | ||
debouncedLog('World'); | ||
debouncedLog('!'); | ||
``` | ||
|
||
### `Throttle.js` | ||
- **Description**: A throttle function in JavaScript limits how often a given function can be called in a given time period. This is particularly useful when handling events like scroll or resize, where frequent firing can impact performance. | ||
- **Usage**: The `throttle` function takes two arguments: the function to throttle and the limit in milliseconds. It returns a throttled version of the function. | ||
- **Example**: | ||
```javascript | ||
const logMessage = (message) => { | ||
console.log(message); | ||
}; | ||
const throttledLog = throttle(logMessage, 1000); | ||
throttledLog('Hello'); | ||
throttledLog('World'); | ||
throttledLog('!'); | ||
``` | ||
|
||
### `hello-world.js` | ||
- **Description**: A simple "Hello, World!" program in JavaScript. | ||
- **Usage**: Run the file using a JavaScript runtime like Node.js. | ||
- **Example**: | ||
```javascript | ||
console.log("Hello, World!"); | ||
``` | ||
|
||
## Contributing | ||
|
||
If you have any JavaScript code examples or utilities that you would like to add to this directory, please follow the contribution guidelines in the main `README.md` file of the repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Kotlin Directory | ||
|
||
This directory contains Kotlin code examples and exercises. Each file demonstrates a specific concept or functionality in Kotlin. | ||
|
||
## Files | ||
|
||
- `hello-world.kt`: A simple "Hello, World!" program in Kotlin. | ||
|
||
## How to Run | ||
|
||
To run the Kotlin programs in this directory, you need to have Kotlin installed on your machine. You can download and install Kotlin from the official [Kotlin website](https://kotlinlang.org/). | ||
|
||
Once Kotlin is installed, you can run the programs using the following command: | ||
|
||
```bash | ||
kotlinc <filename>.kt -include-runtime -d <output>.jar | ||
java -jar <output>.jar | ||
``` | ||
|
||
Replace `<filename>` with the name of the Kotlin file you want to run and `<output>` with the desired name for the output JAR file. | ||
|
||
## Contributing | ||
|
||
If you have any Kotlin code examples or exercises that you would like to add to this directory, please follow the steps below: | ||
|
||
1. Fork the repository. | ||
2. Create a new branch for your changes. | ||
3. Add your Kotlin code to this directory. | ||
4. Update this `README.md` file to include a description of your code. | ||
5. Commit your changes and push them to your forked repository. | ||
6. Create a pull request to the main repository. | ||
|
||
We appreciate your contributions! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# PHP Directory | ||
|
||
This directory contains PHP code examples. Below is a brief description of each file in this directory. | ||
|
||
## Files | ||
|
||
### hello-world.php | ||
A simple PHP script that prints "Hello, World!" to the screen. | ||
|
||
## Contributing | ||
|
||
If you would like to contribute to this directory, please follow the guidelines in the main `CONTRIBUTING.md` file located in the root directory of this repository. Make sure to add a brief description of your PHP script in this `README.md` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Perl Directory | ||
|
||
This directory contains Perl scripts and programs. Below is a brief description of the code in this directory. | ||
|
||
## hello-world.pl | ||
|
||
This script prints "Hello, World!" to the console. It is a simple example to demonstrate the basic syntax of Perl. | ||
|
||
## Contributing | ||
|
||
If you would like to contribute to this directory, please follow the guidelines in the main `CONTRIBUTING.md` file. Ensure that your code is well-documented and adheres to the coding standards of the repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Python Code Examples | ||
|
||
This directory contains code examples written in Python. Each example demonstrates a specific concept or functionality in Python programming. | ||
|
||
## Table of Contents | ||
|
||
1. [Hello World](#hello-world) | ||
2. [Caesar Cipher Encrypt](#caesar-cipher-encrypt) | ||
3. [Caesar Cipher Decrypt](#caesar-cipher-decrypt) | ||
|
||
## Hello World | ||
|
||
The "Hello World" program is a simple program that prints "Hello, World!" to the console. It is often used as the first program when learning a new programming language. | ||
|
||
```python | ||
# Program to print Hello World | ||
|
||
print("Hello World!") | ||
``` | ||
|
||
## Caesar Cipher Encrypt | ||
|
||
The Caesar Cipher is a simple encryption technique where each letter in the plaintext is shifted a certain number of places down the alphabet. The following code demonstrates how to encrypt a message using the Caesar Cipher. | ||
|
||
```python | ||
def caesar_cipher(text, key): | ||
result = "" | ||
for char in text: | ||
if char.isupper(): | ||
result += chr((ord(char) + key - 65) % 26 + 65) | ||
elif char.islower(): | ||
result += chr((ord(char) + key - 97) % 26 + 97) | ||
else: | ||
result += char | ||
|
||
return result | ||
text = input("Enter the string to encode: ") | ||
key = int(input("Enter the shift key: ")) | ||
|
||
encoded_text = caesar_cipher(text, key) | ||
print(f"Encoded string: {encoded_text}") | ||
``` | ||
|
||
## Caesar Cipher Decrypt | ||
|
||
The Caesar Cipher decryption is the reverse process of the encryption. It shifts each letter in the ciphertext back by the same number of places to get the original plaintext. The following code demonstrates how to decrypt a message using the Caesar Cipher. | ||
|
||
```python | ||
def caesar_decrypt(text, key): | ||
result = "" | ||
for char in text: | ||
if char.isupper(): | ||
result += chr((ord(char) - key - 65) % 26 + 65) | ||
elif char.islower(): | ||
result += chr((ord(char) - key - 97) % 26 + 97) | ||
else: | ||
result += char | ||
return result | ||
|
||
text = input("Enter the encoded string: ") | ||
key = int(input("Enter the shift key: ")) | ||
|
||
decoded_text = caesar_decrypt(text, key) | ||
print(f"Decoded string: {decoded_text}") | ||
``` |
Oops, something went wrong.