Eunhan's library

Eunhan's web site

The Bast Loop Statement Out Of For, While, Recursion

Purpose Most programming languages provide for, while, recursion loop statements. Which one is best? for I know how many repeat needed Cannot repeat with certain condition (need to use if and break) Hard to use previous result to next repeated loop Good usage example : print numbers in array. while I do not know how many repeat needed repeat with certain condition Hard to use previous result to next repeated loop Good usage example : count how may words you typed recursion I know how many Stack Memory that will use repeat with certain condition Easy to use previous result to next repeated loop Good usage example: find 88th’s Fibonacci number additional considerable conditions Does your programming language provide tail recursion Program environment such as embedded, Android, or Web Conclusion

personal blog with Hugo-5.add github action

Purpose Create personal blog with Hugo and hosting with github at Windows 10. For this purpose, you need knowledge of HTML, Markdown, and Hugo structure. If you knwo golang, css, js, that will be better. But you do not have to. used tools install date : 03-31-2021 hugo version : hugo v0.82.0 git version : git version 2.31.1.windows.1 windows : 10 windows terminal: v1.7.572.0 Chocolatey : v0.10.15 add github action I finished build github website with Hugo.

personal blog with Hugo-4. hosting by github

Purpose Create personal blog with Hugo and hosting with github at Windows 10. For this purpose, you need knowledge of HTML, Markdown, and Hugo structure. If you knwo golang, css, js, that will be better. But you do not have to. used tools install date : 03-31-2021 hugo version : hugo v0.82.0 git version : git version 2.31.1.windows.1 windows : 10 windows terminal: v1.7.572.0 Chocolatey : v0.10.15 upload to github create two repository on github 1st repository: actual Hugo code will be here 2nd repository: Hugo render the 1st repository data into HTML The github will host 2nd repository to show on online.

what is comparable in Java

Hierarchy package: java.lang.Comparable Definition Sorting interface that designed for a condition by overriding compareTo method. For example, you can sort list in ascending order of size. about the compareTo() method if compareTo() method return positive number, swap the input parameters else will be remain same condition return First parameter < second parameter negative First parameter == second parameter 0 First parameter > second parameter positive How to use customObject implements Comparable<>

what is comparator in Java

Hierarchy package: java.util.Comparator Definition Sorting interface that designed for mutiple special conditions by creating compare method. For example, you can sort list in ascending order of size and descending order of letters. about the compare() method if compare() method return positive number, swap the input parameters else will be remain same condition return First parameter < second parameter negative First parameter == second parameter 0 First parameter > second parameter positive How to use MyComparator implements Comparator<>

what is iterator in Java

Definition Interface that can read any class in the collection framework. Thus, we can read arraylist or linkedlist or hashmap with iterator. why we use iterator? Since we can read any list or set with iterator, we do not have to fix or change code when you work with big projects. Hierarchy method hasNext() next() remove() method Example List list = new ArrayList();// arrayList list.add("1"); list.add("2"); list.add("3"); Iterator <string> itr = list.

conditional and loop statement in Python-if, for, while

conditional statement and loop statement in Python conditional statement (if statement) One Condition Keyword: if if [condition] : [space]code you want to learn Multiple Condition Keyword: elif if must there before use elif if [condition] : [space]code you want to learn elif [condition] : [space]code you want to learn elif [condition] : [space]code you want to learn Other than Condition Keyword: else if must there before use else if [condition] : [space]code you want to learn else : [space]code you want to learn if Statement Example a = 3 if a > 5: print("a is bigger than 5") elif a > 0: print("a is bigger than 0 but smaller than 5") else: print("a is negative") Loop Statement (for Statement) Repeat Example 10 times loop for i in range(10): print("Hi") list loop Example Repeat as much as elements in list a = ["A", "B", "C"] for i in a: print(i) # A B C list loop with index Example Repeat as much as elements in list for i, j in enumerate(a): print(i, ":", j) # 0 : A # 1 : B # 2 : C add two list and loop Example The pair’s data type is tuple numbers = [9, 7, 7] letters = ["z", "x", "y"] for pair in zip(numbers, letters): print(pair) # (9, 'z') # (7, 'x') # (7, 'y') Loop with certain index Example 5 to 9 for i in range(5, 10): # 5 ~ 9 print("Hello", i) # Hello 5 # Hello 6 # Hello 7 # Hello 8 # Hello 9 loop until certain condition loop until i is “o” a = "balloon" for i in a: print(i) if i == "o": break # b a l l o Loop Statement (while Statement) loop until certain condition loop until i is bigger than 5 i = 0 while i < 5: print(i) i = i + 1 # 0 1 2 3 4

Set of Data Structures in Python

Set Definition One of the data structure in python. Create set of data Data Structures in Python List: Tuple: ( ) Dictionary: { key : value } set: { } declaration use { and } to declare setA={1,3,4,"test"} # {1, 'test', 3, 4} setB={2,4,"test",5,6} # {2, 'test', 4, 5, 6} Characteristics No duplicated value Do not care about order set algebra(union, intersection, difference, symmetric difference) Set Algebra union Keyword: “|”, “union()”

Hash Algorithm - Hash Crash

Definition one of problems while using the hash algorithm. If the input value is different, the output value should be different. But, the output is same. We calls, “Hash Crash” Characteristics less hash crush is better hash algorithm No hash crush is almost impossible. Example [input]->[output] A->03 B->02 C->03 The output of A and C are same. This is hash crush. solution Most hash algorithm search next output when hash crush happen.