Matsushita's Blog


Insert Delete GetRandom O(1) - Duplicates allowed

問題 通常のHashTableの機能に加え、テーブル内の要素をランダムで返すメソッドを実装されているデータ構造を作る。データ構造内の要素は重複が許されており、重複した要素の数はランダムな要素を返す関数に影響する。 ソースコード

Knowledges about Java 【Interview preparation】

Introduction This article is for my preparation of technical interview. And this focuses on programming language “Java”. final keyword The final keyword in Java has different meaning depending on whether it is applied to a variable, class …

About ArrayList class in Java

What’s ArrayList The ArrayList class implements the List interface. ArrayList supports dynamic arrays that can grow as needed. Standard Java arrays are of a fixed length. After arrays are created, they cannot grow or shrink, which means th…

Create a Linked List of all the nodes at each depth in Binary Tree

Problem Given a binary tree, design a algorithm which creates a linked list of all the nodes at each depth (e.g, if you have a tree with depth D, you'll have D linked lists) How to Solve The important point of the this problem How we shoul…