Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more algorithms! #9

Open
16 of 32 tasks
cozek opened this issue Oct 10, 2019 · 13 comments
Open
16 of 32 tasks

Add more algorithms! #9

cozek opened this issue Oct 10, 2019 · 13 comments
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed

Comments

@cozek
Copy link
Member

cozek commented Oct 10, 2019

EDIT 6/10/20: If you are making a PR for hacktoberfest, please say so in your PR description so that I can add
the hacktoberfest-accepted label.

This repo needs more algorithms. If you see any missing algorithms, kindly contribute.
Hackotberfest participants are welcome!
I will list some of the algorithms that are up for grabs. However, please check if the algorithm
is already in our repo before you begin working.
Feel free to help me add more items to the list. If you have any questions, ask away!

Some Guidelines:

  1. Please create 1 pull request per algorithm for ease of review.
  2. Please do not plagiarise. Implementations must be your own. If you have used help from some article (say Wikipedia), give credit in your script in a comment.
  3. Give a brief explanation/links of what your script does.
  4. Give helpful comments where you deem necessary. Don't add comments where it's trivial such as x = y + z % adds two numbers or is unnecessary.
  5. Use proper variable names and filename. If you are working on prime check, please use a proper file name such as prime_check.m rather than primec.m
  6. Incase your algorithm required multiple files, create a subdirectory, for example, the kmeans algorithm requires two files, so we have a subdirectory for it. Try not to add unnecessary files.
  7. This repo is for educational purposes. Please keep that in mind when you are working on a contribution to this repo.
  8. Following this coding style guideline is recommended for all PRs.

Sorting Algorithms:

  • Merge sort
  • Insertion Sort
  • Radix sort
  • Quick sort
  • Bubble sort
  • Bucket sort

Searching Algorithms:

  • Linear Search
  • Binary Search
  • Quick Search
  • Jump Search

Math:

  • Factorial
  • Fibonacci series
  • Prime factors
  • Prime check
  • Softmax
  • Jaccard Similarity
  • Greatest Common Divisor
  • Euclidean Distance
  • Hamming Distance
  • Find LCM
  • Find HCF
  • Sum of arithmetic series
  • Sum of geometric series

Machine Learning:
NOTE: Please try to use standard datasets for these problems that are freely available
and perhaps popular, such as the iris dataset. Or datasets that are already inbuilt in Matlab/Octave.

  • Linear Regression
  • Logistic Regression
  • Gradient Descent
  • DBScan
  • K nearest neighbors
  • K medoid clustering
  • Fuzzy C-means
  • Single Layer Perceptron
  • RBF NN
@cozek cozek added help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest labels Oct 10, 2019
@cozek cozek pinned this issue Oct 10, 2019
@cozek cozek unpinned this issue Oct 10, 2019
@cozek cozek pinned this issue Oct 10, 2019
@MaSi-dev
Copy link
Contributor

Dear @cozek , I've sent PR for adding Fibonacci series to Math. please feel free to comment or ask for any changes.

@MaSi-dev
Copy link
Contributor

I've also sent PR for adding algorithm of factorial to Math.

@cozek
Copy link
Member Author

cozek commented Oct 12, 2019

I've also sent PR for adding algorithm of factorial to Math.

I have merged your PR. Thank you for your contribution!

@MaSi-dev
Copy link
Contributor

Thanks for your kind response.
You should actually notice that you mustn't change the file name from factor.m to factorial.m, because Matlab already has a function with the same name and our factorial function will be unusable!

@cozek
Copy link
Member Author

cozek commented Oct 12, 2019

Thanks for your kind response.
You should actually notice that you mustn't change the file name from factor.m to factorial.m, because Matlab already has a function with the same name and our factorial function will be unusable!

Seems like I did an oopsie. Hahaha. No matter, the name change is just for indexing purpose.
I am sure our readers will notice the problem and change the file/function names accordingly.
Or perhaps, we should leave a comment in the script making our readers aware.

EDIT: i changed it to find_factorial. I think that solves the issue.

@cozek
Copy link
Member Author

cozek commented Oct 12, 2019

@atousa1 @MaSi-dev I have added more problems to the math section, have a look! :)

@MatteoRaso
Copy link
Contributor

I made a PR for an insertion sorting algorithm.

@cozek
Copy link
Member Author

cozek commented Feb 3, 2020 via email

@navkiran
Copy link
Contributor

I made a PR for two image processing algorithms. Please review. I missed the guideline of 1 PR per algorithm, I'll keep it in mind for the future.

@cozek cozek mentioned this issue Jun 9, 2020
@harshitpant1
Copy link
Contributor

Hi all, I want to contribute the jump search algorithm:

function found_at = jump_search(arr, value)
  % Contributed by   - Harshit Pant, harshitpant83@gmail.com
  
  % arr       - The input array, should be sorted in ascending order.
  %             'arr' can contain -ve numbers as well as non-integers.
  % value     - The value to be searched in the array.
  % found_at  - The index at which 'value' is found in 'arr'.
  %             -1 is returned if 'value' is not found in 'arr'.

  n = length(arr);

  % 'm' holds the block size
  m = sqrt(n); 
  m = round(m); 
  low = 1;
  high = 1 + m;

  found_at = -1; 

  while arr(min(high, n)) < value
      low = high;
      high = high + m;
      if low >= n
          return;
      endif;
  endwhile;

  while arr(low) < value
      low = low + 1;
      if low > min(high, n)
          return;
      endif;
  endwhile;

  if arr(low) == value
      found_at = low;
  endif;

endfunction;


% TEST: 
% Save this file to your local computer, then use the command:
% jump_search([-11.1, -3.3, -1.3, 0.1, 1.5, 3.5, 3.9, 5.5, 7.5, 9.6, 13.7, 21.3, 35.9], 7.5)
% This should return, ans = 9.
% TODO - Transfer this test when automated testing functionality is added to this repository.

Is anyone available to review? I'd like to send a PR. Thankyou.
(/cc @cozek, @Panquesito7 @ayaankhan98)

@ayaankhan98
Copy link
Member

Hi all, I want to contribute the jump search algorithm:

function found_at = jump_search(arr, value)
  % Contributed by   - Harshit Pant, harshitpant83@gmail.com
  
  % arr       - The input array, should be sorted in ascending order.
  %             'arr' can contain -ve numbers as well as non-integers.
  % value     - The value to be searched in the array.
  % found_at  - The index at which 'value' is found in 'arr'.
  %             -1 is returned if 'value' is not found in 'arr'.

  n = length(arr);

  % 'm' holds the block size
  m = sqrt(n); 
  m = round(m); 
  low = 1;
  high = 1 + m;

  found_at = -1; 

  while arr(min(high, n)) < value
      low = high;
      high = high + m;
      if low >= n
          return;
      endif;
  endwhile;

  while arr(low) < value
      low = low + 1;
      if low > min(high, n)
          return;
      endif;
  endwhile;

  if arr(low) == value
      found_at = low;
  endif;

endfunction;


% TEST: 
% Save this file to your local computer, then use the command:
% jump_search([-11.1, -3.3, -1.3, 0.1, 1.5, 3.5, 3.9, 5.5, 7.5, 9.6, 13.7, 21.3, 35.9], 7.5)
% This should return, ans = 9.
% TODO - Transfer this test when automated testing functionality is added to this repository.

Is anyone available to review? I'd like to send a PR. Thankyou.
(/cc @cozek, @Panquesito7 @ayaankhan98)

Make a proper PR, maintainers will review.

@harshitpant1
Copy link
Contributor

Ok, thanks.

@AstroDude01
Copy link

I have created a PR. Would you please review and suggest if any changes are required
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants