### Ruby Algorithms

Not CompletedIntroduction to Sorting Algorithms in Ruby

Welcome to the algorithms section of this course. The next few lessons are sure to be interesting as we are going to talk about some advanced topics in computer science. These algorithms show you how programming works in the real-world and they will also help give you the tools for building your own advanced programs, so it's important to learn them.

Not CompletedHow to Implement the Bubble Sort Algorithm in Ruby

In this lesson, we are going to implement the bubble sort algorithm. To recap from our algorithm overview, bubble sort compares elements by comparing a value with the next value to determine which value is higher (or lower depending on the goal). Accordingly, typically it sorts through the entire list many times. As mentioned in the previous lesson, bubble sort is not effective for real-world programs because it's too slow.

Not CompletedHow to Implement the Quick Sort Algorithm in Ruby

Quick sort is the one of the most complex sorting algorithms to implement, and it is also considered the most efficient in many cases.

Not CompletedHow to Implement the Merge Sort Algorithm in Ruby

In this lesson on sorting algorithms, we are going to finish with merge sort. Though it's a popular sorting method, it's not used as much as quick sort because it is slightly slower. Personally though, I love merge sort because it is easy to understand from a high-level view. In terms of coding, it has a slightly longer code implementation, but is also easier to understand.

Not CompletedHow to Implement a Prime Number Counting Algorithm in Ruby

In this lesson, we are going to create an algorithm that finds all prime numbers between zero to two million. Sounds exciting? In traditional programming languages, this algorithm would need a ton of code, but in Ruby we're going to see how to implement this efficiently.

Not CompletedHow to Code the Power Digit Sum Algorithm in Ruby

In this lesson, we are going to see how to solve a complex math problem from Project Euler that asks us to solve the question: What is the sum of the digits of the number 2 to the 1000th power?

Not CompletedHow to Implement a Humanize Counting Algorithm in Ruby

In this lesson, we are going to solve another complicated problem from Project Euler (question #17) that asks us to solve the question: If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?.

Not CompletedHow to Implement a Date Algorithm in Ruby

In this lesson, we are going to see how to solve another fun and challenging problem from Project Euler (question #19) where we need to figure out an efficient solution to the question: How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?

Not CompletedHow to Code a Fibonacci Digit Counter in Ruby

In this lesson, we are going to solve another fun problem from Project Euler (problem #25), that asks us to solve the problem What is the index of the first term in the Fibonacci sequence to contain 1000 digits?.

Not CompletedHow to Implement a Permutation Algorithm in Ruby

In this lesson, we are going to build a powerful algorithm that is going to use many important functionalities of Ruby. The problem that we are going to solve is Project Euler problem 24 that asks: What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?

Not CompletedHow to Implement an Amicable Number Algorithm in Ruby

In this lesson, we are going to find a solution in Ruby for a complex problem from Project Euler (problem #21) that asks: Evaluate the sum of all the amicable numbers under 10000. Clear as mud right? Essentially, you take a number, identify all its divisors and add them together to get a value. Next, take that final sum value, identify its divisors and add them together. If this second sum value is the same as the original number for which you found divisors in the first place, then both the original number and its final sum are considered as amicable numbers.

Not CompletedHow to Implement a Factorial Algorithm in Ruby

Another interesting problem that we are going to tackle in this lesson is problem #20 in Project Euler called the Factorial digit sum. In this program we need to solve the question: Find the sum of the digits in the number 100!. This is a perfect problem to practice a number of topics we have learned in this Ruby programming course.

Not CompletedImplement an Even Fibonacci Number Algorithm in Ruby

In this lesson, we are going to solve problem #2 in Project Euler, where we're asked to find even fibonacci numbers, the actual question being: By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

Not CompletedHow to Implement the Least Common Multiple in a Ruby Program

In this lesson, we are going to solve problem #5 in Project Euler using some insanely simple Ruby code. The problem asks us to solve: What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

#### Quizzes

Ruby Algorithms
Unsupported Browser

devCamp does not support ancient browsers.
Install a modern version for best experience.