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
@prasad-madhale
prasad-madhale / gist:89ed85a69f54050c42f15a0d65656211
Created March 9, 2019 23:29 — forked from psayre23/gist:c30a821239f4818b0709
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
@prasad-madhale
prasad-madhale / q.py
Created September 24, 2018 03:57 — forked from fheisler/q.py
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):
@prasad-madhale
prasad-madhale / strassenExample.groovy
Created February 25, 2018 21:48 — forked from phillco/strassenExample.groovy
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).