Skip to content

Instantly share code, notes, and snippets.

View prasad-madhale's full-sized avatar
🎯
Focusing

Prasad Madhale prasad-madhale

🎯
Focusing
View GitHub Profile
@wojteklu
wojteklu / clean_code.md
Last active March 16, 2026 06:58
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@nicolamalizia
nicolamalizia / QuickSelect.java
Created July 4, 2015 15:40
A basic implementation of quickselect algorithm in Java. Intentionally unused generics.
import java.util.Arrays;
/**
* quickselect is a selection algorithm to find the kth smallest element in an
* unordered list. Like quicksort, it is efficient in practice and has good
* average-case performance, but has poor worst-case performance. Quickselect
* and variants is the selection algorithm most often used in efficient
* real-world implementations.
*
* Quickselect uses the same overall approach as quicksort, choosing one
@fheisler
fheisler / q.py
Created March 31, 2015 23:02
Q-learning Tic-tac-toe
import random
class TicTacToe:
def __init__(self, playerX, playerO):
self.board = [' ']*9
self.playerX, self.playerO = playerX, playerO
self.playerX_turn = random.choice([True, False])
def play_game(self):
@psayre23
psayre23 / gist:c30a821239f4818b0709
Last active March 9, 2026 09:44
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@dunenkoff
dunenkoff / AStar.cs
Created May 7, 2014 21:04
A* pathfinding implementation for Unity3D, using raycasting and colliders for obstacles
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class AStar {
// A* pathfinding
/// <summary>
/// Returns estimated cost of moving from point A to point B.
@phillco
phillco / strassenExample.groovy
Created February 7, 2012 04:34
Example step-through of Strassen's method for matrix multiplication on 2x2 matrices
/* MULTIPLIES A and B =============
using Strassen's O(n^2.81) method
A = [1 3] B = [6 8]
[7 5] [4 2]
C = A * B = ?
=================================*/
// Step 1: Split A and B into half-sized matrices of size 1x1 (scalars).