Skip to content

Instantly share code, notes, and snippets.

View aturan23's full-sized avatar

Assylkhan Turan aturan23

  • Software developer
  • Kazakhstan, Almaty
View GitHub Profile
@aturan23
aturan23 / MemoryUsage
Created November 24, 2017 06:46
Memory usage of sorts
package lect;
public class MemoryUsage {
private static final long MEGABYTE = 1024L * 1024L;
private static final long KILOBYTE = 1024L;
public static long bytesToKilobytes(long bytes) {
return bytes / KILOBYTE;
}
package lect;
public class MyArrayList<E> extends MyAbstractList<E> {
public static final int INITIAL_CAPACITY = 16;
private E[] data = (E[])new Object[INITIAL_CAPACITY];
/** Create a default list */
public MyArrayList() {
}
package lect;
import java.util.Comparator;
import java.util.Iterator;
public class MyLinkedList<E> extends MyAbstractList<E> {
public Node<E> head;
private Node<E> tail;
Node<E> sorted;