Skip to content

saeed-vayghan/Algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithm

Collection of pure js algorithms.

Tip: JS Default sort()

In JavaScript uses insertion sort by V8 Engine of Chrome and Merge sort by Mozilla Firefox and Safari. It is not suitable if you need to sort large number of elements. So, the solution is to use Quick sort for large dataset.

Tip: Dynamic programming / Memoization

solves a problem by dividing it into smaller subproblems. This is very similar to the divide-and-conquer algorithm solving technique. The major difference, however, is that dynamic programming solves a subproblem only once. It then stores the result of this subproblem and later reuses this result to solve other related subproblems. This process is known as memoization.

Basic

  1. Find lonely integer in a list; xor all the values and the lonely integer will be the result.

Samples

  1. bubble-sort.js: Bubble sort
  2. insertion-sort.js: Insertion sort
  3. merge-sort.js: Merget sort
  4. selection-sort.js: Selection sort
  5. quick-sort.js: Quick sort
  6. binary-search.js: Binary Search
  7. max-sub-array-sum.js: Maximum Sub Array Sum
  8. count-negative-ints-sorted-matrix.js: Count Negative Integers in Row/Column Wise Sorted Matrix
  9. lowest-common-ancestor.js: Lowest common Ancestor
  10. ways-to-decode-message.js: How many ways to decode a message?
  11. find-sets-of-numbers-adds-up-to-x.js: Dynamic Programming, Find Sets Of Numbers That Add Up To X
  12. all-subsets-of-a-set.js: All possible subsets of a set
  13. detect-cycles-in-linked-list.js: Detect cycles in a given Linked List
  14. is-valid-binary-trree.js: Check if a Binary Tree is a valid one.
  15. pair-sums.js: Pair Sums
  16. rotational-cipher.js: Rotational Cipher
  17. contiguous-subarrays.js: Contiguous Subarrays
  18. coin-change.js: Coin Change Problem
  19. recursive-stair-cases.js Recursice StairCases
  20. reverse-singley-linked-list.js Reverse A Singly Linked List

More To Do

  1. finding-k-smallest-items.js: Finding the K smallest items.
  2. RANDOMLY Reorder Array in O(N)?
  3. Find pair of numbers in two arrayas that their sum is closet to a specific target!
  4. Tower Hopper Problem!
  5. Finding Continuous Median (Max-Min Heap)
  6. Merge K sorter Array (brute force, priority queue, min heap)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published