MindMap Gallery Notes on knowledge point framework of common algorithms for arrays
Commonly used algorithms for arrays include one-dimensional arrays, enhanced loops, variable parameters, command line parameters, common algorithms, two-dimensional arrays, and array copy knowledge points. It is suitable for friends who organize and memorize knowledge points.
Edited at 2022-11-15 09:53:42One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
Project management is the process of applying specialized knowledge, skills, tools, and methods to project activities so that the project can achieve or exceed the set needs and expectations within the constraints of limited resources. This diagram provides a comprehensive overview of the 8 components of the project management process and can be used as a generic template for direct application.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
Project management is the process of applying specialized knowledge, skills, tools, and methods to project activities so that the project can achieve or exceed the set needs and expectations within the constraints of limited resources. This diagram provides a comprehensive overview of the 8 components of the project management process and can be used as a generic template for direct application.
Notes on knowledge point framework of common algorithms for arrays
Array overview
What is an array
Array is a data structure used to store "a group of data of the same type"
Array variables are reference data types
The elements in the array can be of any data type (basic types and reference types)
An array has a corresponding index, and each element in the array can be accessed through the index.
After an array is created, its size cannot be changed, but each element in the array can be changed.
one-dimensional array
statement
int a[];
int[] a1;
double b [];
Mydate[]c;
You cannot specify the length of an array when declaring it
initialization
dynamic initialization
new data type [size]
new data type []{element 1, element 2...element n}
static initialization
Initialize the array while defining it
int a[] = {1,3,5,7,9,11};
String s [] = {"a","b","c"};
Simple data type array (Refer to the memory change chart on PPT)
definition
create
Reference data type array (Refer to the memory change chart on PPT)
definition
create
initialization
Default initialization rules for array elements
Reference method of array elements: array name [subscript]
Enhance for loop
for (data type variable name: array variable name) {...}
Purpose: Only suitable for sequentially traversing and displaying the contents of all elements in an array or collection.
Defect: Index (subscript) value cannot be accessed when traversing an array or collection
variable parameter
When declaring a method .....Method name (data type... variable name)
It can accept 0-n parameters of this type. Use arrays in methods to process
Variable parameters must be written at the end of the formal parameter list, Otherwise, a compilation error will be reported.
Command line parameters
java class name abc "hello world" 123 "ni hao"
Pass parameters to (String args[]) of the main method
Commonly used algorithms
sort
Bubble Sort
selection sort
insertion sort
Find
Search sequentially, starting from the first element and searching sequentially
binary search
Prerequisite: Search in sorted array
Basic idea
code
java.util.Arrays Array operation tool class
public static void sort(int[] a);
public static int binarySearch(int[] a, int key); //Use binary search method, provided that the array has been sorted from small to large
public static String toString(int [] a) //Format the incoming array into string output
Two-dimensional array
array of arrays
initialization
static initialization
dynamic initialization
array copy
System.arraycopy(.....)
public static int[] copyOf(int[] original, int newLength) of Arrays class