Skip to content

abhaykumarvats/pythonism

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pythonism

The Python I like.

Hangman

Hangman is a paper and pencil guessing game for two or more players. One player thinks of a word, phrase or sentence and the other tries to guess it by suggesting letters or numbers, within a certain number of guesses. More

This is my implementation of (the functions of) the game in Python. Template provided by MIT (6.00.1x).

Tower of Hanoi

The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower and sometimes pluralized) is a mathematical game or puzzle. It consists of three sticks and a number of disks of different sizes, which can slide onto any stick. The puzzle starts with the disks in a neat stack in ascending order of size on one stick, the smallest at the top, thus making a conical shape. More

Short, simple yet beautiful and elegant solution of Tower of Hanoi in Python. Uses a recursive algorithm. So easy to understand, doesn't even need comments. 3 Sticks + Any Number of Discs = This Thing Works!

Fibonacci

In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones:

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,...

Often, especially in modern usage, the sequence is extended by one more initial term:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,... More

Recursive: Uses recursive algorithm. Very slow for large inputs.

Memoization: Uses recursive algorithm with a technique called Memoization. Memoization takes help of dictionary data structure in Python.

Generator: Uses Generator method to generate Fibonacci numbers, one by one.

Merge Sort

In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output. More

This implementation uses recursion to sort the list.