当前位置:网站首页>LinkedList learning
LinkedList learning
2022-06-29 02:38:00 【Why not sell egg cakes well】
Different data structures lead to different characteristics , The linked list structure is good at handling the problem of adding and deleting ( Just modify the pointer of a few elements ), Arrays are good for processing queries ( Array subscripts are easy to locate )
The code is as follows
First in first out queue , Linked list form .
Elements are connected by storing each other's location information , Search slow , add to / Delete fast .
There is no data movement problem , Just modify the subsequent pointer .
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.add("hello");
list.add("world");
System.out.println(list);
list.addFirst("A");
list.addLast("B");
System.out.println(list);
list.add(2,"2");
System.out.println(list);
// fifo Add from left
list.push("javase");
System.out.println(list);
System.out.println(list.getFirst());
System.out.println(list.peek());
System.out.println(list.peekFirst());
// Take the value out , Does not exist.
System.out.println(list.pop());
System.out.println(list);
}

边栏推荐
- Talk about the copyonwritearraylist of JUC
- e. Difference between target and e.currenttarget
- 字符串输出
- 字符串属性练习
- Bluetooth solution | Lenz technology Amazon direct connected magic lantern solution
- CTFHub-Web-密码口令-弱口令
- centos7 安装php7.2
- 线程池是什么老鸡?
- String output
- Which securities company is the largest and safest? Which securities company has good service
猜你喜欢
随机推荐
Programmers whose monthly salary is less than 30K must recite the interview stereotype. I'll eat it first
China's flexible employment has reached 200million
字符串属性练习
CTFHub-Web-密码口令-默认口令
PWN攻防世界guess_num
Is there any risk in opening an account for Dongfang fortune stock? Is it safe for Dongfang fortune to open an account
String output
线程池是什么老鸡?
信息学奥赛一本通 1361:产生数(Produce)
Pvcreate ASM disk causes abnormal recovery of ASM disk group - sparing separation
字符串分段组合
What is the dry goods microservice architecture? What are the advantages and disadvantages?
thinkphp5.1 runtime文件改成777权限了, 还是无法写入
温度转换 II
Quelques tests pour compléter l'environnement wasm
Apache does not parse PHP files, but directly displays the source code
String attribute exercise
LabVIEW generate application (exe) and installer
LinkedList学习
安装kibana









