Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
import "github.com/skelterjohn/go.matrix"
func main() {
dmat := matrix.Zeros(4, 3)
dmat.Set(0, 1, 7)
fmt.Println(dmat)

Real malloc challenge!

Instruction

Your task is implement a better malloc logic in malloc.c to improve the speed and memory usage.

How to build & run a benchmark

# build
/* exported stringifyJSON */
const stringifyJSON = (obj) => {
/* ------ Define submodules ------- */
let result = ""
const stringifyString = (elem) => {
// `elem` : Element of the input object. It's data type is string.
result += `"${elem}"`;
return result;

Is that page accesible from Google? Check it by BFS!

Task

Find something interesting from the graph of Wikipedia.

My work

minimumStepFromGoogle(start_id, target_id) returns the minimum step from Google's Wikipedia page to a random Wikipedia page.

How to run

@mutokrm
mutokrm / cache.md
Last active May 26, 2022 08:39
Week 2 - cache, tree_vs_hashtable, and matrix

The program description of cache.py

Summary of the program

cache.py records a cache that stores the most recently accessed N pages where N is a given number. It, in addition, returns the cache starting with the most recently accessed page and ending with the least recently accessed one. The time complexity of updating a cache is mostly done in O(1) time. This is because a doubly linked list, which requires only O(1) time to add or delete element when we know the index of it, stores a cache. The nodes of the doubly linked list are hashmap type. A node has an url as a key and other information (the page url, contents, previous node, next node) as a value.

This is a big picture that illustrates what a cache looks like after accessing “a.com”, “b.com”, and “c.com”.
A picture of nodes.


How the program works

@mutokrm
mutokrm / findAnagram2-desc.md
Last active October 11, 2022 07:27
Added a program description and updated code. An issue I'd like to discuss with you is written on the bottom of "findAnagram2-desc.md".

The program description of findAnagram2.py

Summary of the feature

This program finds one or multiple word(s) that can be consisted of the characters of the word you input. It eventually returns a word that has the highest score among them.

e.g., it should find ["at", "cat"] if you input "tac" and finally returns "cat".


The program has five processes

@mutokrm
mutokrm / findAnagram_1.py
Last active May 13, 2022 03:20
Updated the solution for the 1st assignment; Used hashmap whose key is a sorted word and values are original words. Added the description of time complexity in each function.
# How to run
# python3 findAnagram1.py
# ----- define functions ----- #
import re
def sortWordsInDictionary(original_dictionary): # The time complexity is NlogN where N is the number of words in a dictionary
# returns a hashmap whose keys are an alphabetically sorted words and values are original words ex) {"aet" : "eat", "tea"}
dictionary = {}