Coder Social home page Coder Social logo

kumar91gopi / algorithms-and-data-structures-in-ruby Goto Github PK

View Code? Open in Web Editor NEW
705.0 30.0 246.0 103 KB

Ruby implementation of Algorithms,Data-structures and programming challenges

Ruby 100.00%
algorithm maximum-element array-rotation repeated-elements codility stack hackerrank sorted-arrays bubble-sort distinct-elements

algorithms-and-data-structures-in-ruby's Introduction

Algorithms and Data Structures in Ruby

This repository contains Ruby implementation of various Algorithms and Data structures and solution of many challenges of HackerRank and Codility

Content :

  1. Binary Search
  2. Ubiquitous Binary Search (Binary search implementation with various applications)
  3. Problems based on Binary Search
  1. Minimax Algorithm
  1. Bubble Sort
  2. Optimized Bubble Sort
  3. Selection Sort
  4. Insertion Sort
  5. Shell Sort
  6. Merge Sort
  7. Quick Sort
  8. 3 way Quick Sort
  9. Counting Sort
  10. Pancake Sort
  11. Sort array in wave form
  12. Sort a given array by frequency of elements
  13. Radix Sort
  14. Heap Sort
  1. Swapping two numbers
  2. Algorithm for reversing an array
  3. Algorithms for array rotation
  4. Subarray Problems(Kadane's Algorithm)
  5. Find missing number in array
  6. Shuffling an Array
  7. Find pair in array with sum equal to given value
  8. Find pair in array with difference equal to given value
  9. Find pair in array with sum closest to given value
  10. Find triplet in array with sum equal to given value
  11. Find Pythagorean triplet in given array
  12. Find equilibrium index in an array
  13. Find fixed point in an array
  14. Dutch National Flag Problem
  15. Move all zeros to the end of array
  16. Find all Leaders in an array
  17. Find smallest missing number in sorted array
  18. Majority Element in an array
  19. Find minimum element in sorted rotated array
  20. Search element in sorted rotated array
  21. Find maximum element in a Bitonic Array
  22. Find no. of occurences of an element in a sorted Array
  23. Find floor and ceil of given element in a sorted Array
  24. Replace every element by product of previous and next
  25. Find the element with odd occurences if all other elements have even occurences
  26. Print the maximum element in each k-sized subarray
  27. Print Next Greatest Element for each element of array
  28. Replace every element by maximum element on the right side(Next Greatest Element)
  29. Find the smallest and second smallest in a given array
  30. Find the maximum sum with no adjacent elements
  31. Given two sorted arrays find the union and intersection of arrays
  32. Given unsorted array of numbers check if numbers are consecutive
  33. Sort a given array by frequency of elements
  34. Create a product array from given array
  35. Find the median of two sorted array of equal size
  36. Given a 2D array,print its all elements in spiral order
  37. Find two repeating elements in given array
  38. Minimum length unsorted subarray,sorting which makes the array sorted
  39. Find max diff between 2 elements such that larger appears after smaller
  40. Find duplicates in array in O(n) time and constant space
  41. Print all distinct elements of given array
  42. Given an array array, find the maximum j โ€“ i such that the element later is bigger
  1. Find pair in array with sum equal to given value(Approach 1)
  2. Find pair in array with difference equal to given value(Approach 2)
  3. Sort a given array by frequency of elements
  4. Print all distinct elements of given array(Approach 2)
  1. Print Next Greatest Element for each element of array
  1. Check if a given number is power of 2 or not
  2. Check if a given number is even or odd
  3. Given a number return a number with last bit unset
  4. Count the number of set bits(Brian Kernighan's method)
  5. Find missing number in array(Approach 2)
  6. Find two repeating elements in given array(Approach 4)
  1. Fast multiplication of two numbers(Russian Peasant Multiplication)
  2. Babylonian Method to find Square root of a number
  3. Find missing number in array(Approach 1)
  4. Find two repeating elements in given array(Approach 1)

Algorithms

Warm up
  1. A Very Big Sum
  2. Diagnol Difference
  3. Plus Minus
  4. Simple Array Sum
  5. Solve Me First
  6. Staircase
  7. Time Conversion
Implementation
  1. Angry Professor
  2. Chocolate Feast
  3. Cut The Sticks
  4. Find Digits
  5. Service Lane
  6. Sherlock And Squares
  7. Sherlock And The Beast
  8. Utopian Tree
Others

1.Modified Kaprekar Number~New approach added by @madmantalking

Iterations
Arrays
Time-complexity
Counting Elements
Prefix Sums
Sorting
Stacks and Queues
Leader
Maximum Slice Problem
Prime and Composite numbers
Others

algorithms-and-data-structures-in-ruby's People

Contributors

affanmalik02 avatar fatosmorina avatar kumar91gopi avatar madmantalking avatar mikezalik avatar shrynx avatar tasawar-hussain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

algorithms-and-data-structures-in-ruby's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.