FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Data-Structures-Algorithms/Structures/DoublyLinkedList.java at master · sambey04/Data-Structures-Algorithms · GitHub
sambey04
/
Data-Structures-Algorithms
Public
forked from
CodersForLife/Data-Structures-Algorithms
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Data-Structures-Algorithms
/
Structures
/
DoublyLinkedList.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (39 loc) · 837 Bytes
Breadcrumbs
Data-Structures-Algorithms
/
Structures
/
DoublyLinkedList.java
Copy path
File metadata and controls
45 lines (39 loc) · 837 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
public
class
DoublyLinkedList
extends
LinkedList
{
public
void
insertAtHead
(
int
value
){
Node
newNode
=
new
Node
(
value
);
if
(
this
.
head
==
null
){
this
.
head
=
newNode
;
}
else
{
newNode
.
next
=
this
.
head
;
this
.
head
.
prev
=
newNode
;
this
.
head
=
newNode
;
}
}
public
void
insertAtPos
(
int
k
,
int
value
){
Node
newNode
=
new
Node
(
value
);
int
cnt
=
0
;
Node
temp
=
this
.
head
;
while
(
temp
!=
null
){
if
(
cnt
==
k
){
temp
.
prev
.
next
=
newNode
;
newNode
.
next
=
temp
;
newNode
.
prev
=
temp
.
prev
;
temp
.
prev
=
newNode
;
return
;
}
temp
=
temp
.
next
;
}
System
.
out
.
println
(
"invalid position"
);
}
public
void
deleteValue
(
int
value
){
Node
temp
=
this
.
head
;
while
(
temp
!=
null
){
if
(
temp
.
data
==
value
){
temp
.
prev
.
next
=
temp
.
next
;
temp
.
next
.
prev
=
temp
.
prev
;
return
;
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL