Eunhan's library

Eunhan's web site

Hash Algorithm - Uniformity

Definition one of properties for Hash algorithm map the expected inputs as evenly as possible over its output range without hash crash. Example [input]->[output] first hash algorithm A->03 B->02 C->03 second hash algorithm A->01 B->02 C->03 explanation if the uniformity of hash algorithm is high, it less create hash crush. Thus, the second hash algorithm’s uniformity is higher than the first hash algorithm conclusion high uniformity = less hash crush = higher possible to learn with O(1) of time complexity other questions Can we possible to make perfect hash algorithm that does not make any hash crush?

Hash Algorithm

Definition hash function transfer any value to certain conditioned value such as length. If the input value is same, the output value should be same. In use encryption Hashtable is using hash function to store values quickly. Comparing two huge data to verify same file or not quickly. Kinds cryptographic hash function : hash function that used for encryption hash function : hash function that does not used for encryption Properties efficiency uniformity collision resistance pre-image resistance second pre-image resistance

Dictionary of Data Structures in Python

Dictionary Definition One of the data structure in python. has key and value bined. You can fine value when you know the key very slimier with hashmap Data Structures in Python List Tuple Dictionary set declaration use { and } to declare the value can be list the key can be int or string. But not list. (TypeError: unhashable type: ‘list’) dictionary={"key1":"value1","key2":"value2","key3":"value3"} how to use indexing like List get() method difference between the indexing and get method If key does not exist, the indexing will return error.

what is enum class in Java

Definition enum class is for define constant. It will contain the value that will not change during the program is working Reason for using the enum class Sometimes, the program need constant value that should not changed. We use enum class for define the value. We calls, “define Constant” History The notion of constant is came from C language. C used define Preprocessor and const keyward. C code example #include <stdio.

Fibonacci sequence

Definition Certain patterns of numbers. first and second numbers are always 0,1. next number is addition of previous two numbers The List of Fibonacci numbers $0,1,1,2,3,5,8,13,21,34,55…$ Recurrence Relation $F_0=0$ $F_1=1$ $F_n=F_{n-1}+F_{n-2}$ Example index fibonacci numbers calculation 0 0 0 1 1 1 2 1 0+1 3 2 1+1 4 3 1+2 5 5 2+3 6 8 3+5 7 13 5+8 8 21 8+13 9 34 13+21 10 55 21+34 11 89 34+55 12 144 55+89 13 233 89+144 14 377 144+233 15 610 233+377 16 987 377+610 get nth fibonacci number math public static int fib(int num) { double goldenRatio = (1 + Math.

[python code]get Coordinate by image

get Coordinate by image pyautogui started left-top side of monster. If there are multiple images on screen, only return the coordinate of most left-top side image. If there is no same image, return FileNotFoundError import pyautogui def getCoordinateByImg(imgAddress): imgLocatedCoordinate = pyautogui.locateOnScreen(imgAddress) # get image from the address if (imgLocatedCoordinate): return pyautogui.center(imgLocatedCoordinate) # return the center coordinate. else: print("image never found") raise FileNotFoundError 에러 pyscreeze.PyScreezeException: The Pillow package is required to use this function: type “pip install Pillow –upgrade” in terminal

[python code] keyboard and mouse control

how to install pip install pyautogui Finding Coordinate It will display current mouse coordinate every second. import pyautogui import time while True: print("Current Mouse Position : ", pyautogui.position()) time.sleep(1) mouse control import pyautogui pyautogui.moveTo(300, 300) # move (x=300, y=300) pyautogui.moveRel(x, y, t) # move (from current pos, move x and y with time. If t is 2, it will take 2 second to move) pyautogui.click() # click pyautogui.doubleClick() # double click pyautogui.

Tuple of Data Structures in Python

Tuple Definition One of the data structure in python. Almost same as List But Tuple is not editable. Object. Data Structures in Python List Tuple Dictionary set declaration use “(” and “)” to declear. But, if there is a element in Tuple, you need to add comma tuple1=(1,) tuple2=(1,2,3) notTuple=(0) #wrong, this is int type. comma needed index structure same as List characteristic Tuple is not editable.

install [JAVA-AdoptOpenJDK] to [windows 11]

purpose install [JAVA-AdoptOpenJDK] to [windows 11] Java? One of programming language. For using, you need the programm calls Java Development Kit(JDK). The most famous JDK name is Java. It same as programming language name. Short history The Java JDK was open source. But, the Oracle bought the JDK and make it is not open source. Thus, there are many JDK programs. AdoptOpenJDK? One of the JDK programs. environment variable? Some writings may say that you need to set environment variable for window users.

Heap Sort

Definition one of sort array data structure based on binary tree insert data into binary tree and print out from the tree Algorithm steps insert data into binary tree The data sorted as binary tree print Java code public static void heapSort(int arr[]) { int n = arr.length; // Build heap (rearrange array) for (int i = n / 2 - 1; i >= 0; i--) heapTree(arr, n, i); // One by one extract an element from heap for (int i = n - 1; i > 0; i--) { // Move current root to end int temp = arr[0]; arr[0] = arr[i]; arr[i] = temp; // call max heapify on the reduced heap heapTree(arr, i, 0); } } // To heapify a subtree rooted with node i which is // an index in arr[].