Clarity Input and Output Most mistakes are coming from misunderstanding of range for the input and output. We need to find the range of input and output specifically.
Each Steps of Algorithm must be Clear The steps of algorithm separated clearly. Thus, you or co-workers may not misunderstand the code.
Need to Study computer structure Some codes got issue because of computer structure. If you calculate int type addition, the result is wrong because integer overflow.
1. create repository in github: Repository is kind of folders on your github. Set name and create. Other settings are not needed.
2. taps on top of the Android Studio, click VCS -> Enable Version Control Integration. 3. It will ask something, choose git and push ok button. : There are many other websites that similar to github. Check buttom tab that has Git:master
4. click VCS -> Commit 5. Choose files that you want to upload.
Definition specific method of solving the problem
the problem: It need to be clear. input and output is stated in exact range. specific method: If you do not know how to solve that problem, you can solve it with specific steps.
Example If you get drink from a vending machine,
put cash select drink get drink This is kind of algorithm. However, it specfic enough for computers.
get $3 cash from wallet find input location insert cash into the cending machine check how many kinds of drink choose drink what you want push button for the drink pick up the drink.
Steps create button in layout/activity_main.xml create strings on button in values/strings.xml connect button and set event in MainActivity.kt padding and margin 1. create button in layout/activity_main.xml <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:padding="10dp" android:text="@string/btn" android:textColor="@color/black" app:backgroundTint="@color/white" /> 2. create strings on button in values/strings.xml <string name="btn">Button</string> 3. connect button and set event in MainActivity.kt import android.widget.Button class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // set id from activity_main.
purpose install [git] to [windows 10]
What is git? commend based program that is for tracking file changes. Origianlly, it invented for programming, thus, git file contains information of when did the file created, changed and moved.
steps 1. downlad git official link
2. install the program 3. installation settings Additional icons > On the Desktop : create shortcut
Windows Exporer integration
Git Bash Here : Git Bash connection, any folder can connect with git right away Git GUI Here : Git GUI connection, create some GUI on right click menu Git LFS (Large File Support) - origianlly git was for coding.
Definition Both interfaces are very similer because they are for sorting lists and arrays. However, one is for one condition and other one is for mutiple conditions.
Difference Comparable Comparator java.lang package. java.util package. Comparable affects the original class Comparator doesn’t affect the original class compareTo() method with 1 parameter compare() method with 2 parameters Collections.sort(List) Collections.sort(List, Comparator) Arrays.
code name How ++i prefix increment operator i = i+1;return i; i++ postfix increment operator final int t = i; i = i+1; return t; –i prefix decrement operator i = i-1;return i; i– postfix decrement operator final int t = i; i = i-1; return t; int x = 2; int y = 2; System.
Definition Stable and unstable is depend on how sort any duplicated list.
If the algorithm keeps original position of duplicated values, it is stable sort algorithm
If the algorithm positioned duplicated values randomly, it is unstable sort algorithm
Example raw list=[3(1), 7(1), 3(2), 4, 7(2), 9]
stable sorted list=[3(1), 3(2), 4, 7(1), 7(2), 9]
unstable sorted list=[3(2), 3(1), 4, 7(2), 7(1), 9]
Stable Sorting Bubble Sort
Insertion Sort
Merge Sort
Reason Thrown to indicate that a method has been passed an illegal or inappropriate argument.
argument is actual values that are passed to variables If you put any actual values that is not correct for the variable, it will cause IllegalArgumentException
Example int a = 2147483649; // value is too big int a = -2147483649; // value is too small String date="08-07-1990"; // format is dd-MM-yyyy Date format=new SimpleDateFormat("dd/MM/yyyy").parse(date);// format is different Solution check input value range check calculation that can be over the variable limitation use try-catch block
Kinds of Data Type in Java Primitive type Java provides 8 kinds of Primitive type. Primitive data types cannot contain null actual value will saved in Stack memory. data type base memory defult value range of data range of data in number boolean 1 byte false true, false true, false byte 1 byte 0 -127 ~ 128 $-2^{7}$~ $(2^{7}-1)$ short 2 byte 0 -32,768 ~ 32,767 $-2^{15}$~ $(2^{15}-1)$ int 4 byte 0 -2,147,483,648 ~ 2,147,483,647 $-2^{31}$~ $(2^{31}-1)$ long 8 byte 0L -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 $-2^{63}$~ $(2^{63}-1)$ float 4 byte 0.