Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
linked_list2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liam E. Roeth
linked_list2
Commits
1baf6dd5
Commit
1baf6dd5
authored
Sep 17, 2020
by
Liam E. Roeth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lowercase_function_names
parent
749998c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
llist.c
llist.c
+6
-6
llist.h
llist.h
+6
-6
No files found.
llist.c
View file @
1baf6dd5
...
@@ -93,16 +93,16 @@ NODE *construct_list(datatype list[], int size){
...
@@ -93,16 +93,16 @@ NODE *construct_list(datatype list[], int size){
}
}
int
add_to_end
(
NODE
*
head
,
datatype
new_data
){
int
add_to_end
(
NODE
*
head
,
datatype
new_data
){
return
Insert_N
ode
(
head
,
-
1
,
new_data
);
return
insert_n
ode
(
head
,
-
1
,
new_data
);
}
}
int
Insert_N
ode
(
NODE
*
head
,
int
pos
,
datatype
new_data
){
int
insert_n
ode
(
NODE
*
head
,
int
pos
,
datatype
new_data
){
if
(
head
==
NULL
)
if
(
head
==
NULL
)
return
1
;
return
1
;
if
(
pos
!=
0
)
if
(
pos
!=
0
)
return
Insert_Node_A
fter
(
traverse
(
head
,
pos
-
1
),
new_data
);
return
insert_node_a
fter
(
traverse
(
head
,
pos
-
1
),
new_data
);
else
{
else
{
int
out
=
Insert_Node_A
fter
(
head
,
head
->
data
);
int
out
=
insert_node_a
fter
(
head
,
head
->
data
);
if
(
out
>
0
)
if
(
out
>
0
)
return
out
;
return
out
;
head
->
data
=
new_data
;
head
->
data
=
new_data
;
...
@@ -110,7 +110,7 @@ int Insert_Node(NODE *head, int pos, datatype new_data){
...
@@ -110,7 +110,7 @@ int Insert_Node(NODE *head, int pos, datatype new_data){
return
0
;
return
0
;
}
}
int
Insert_Node_A
fter
(
NODE
*
head
,
datatype
data
){
int
insert_node_a
fter
(
NODE
*
head
,
datatype
data
){
if
(
head
==
NULL
)
if
(
head
==
NULL
)
return
1
;
return
1
;
NODE
*
new
=
construct
(
data
,
head
->
next
);
NODE
*
new
=
construct
(
data
,
head
->
next
);
...
@@ -121,7 +121,7 @@ int Insert_Node_After(NODE *head, datatype data){
...
@@ -121,7 +121,7 @@ int Insert_Node_After(NODE *head, datatype data){
}
}
int
L
ength
(
NODE
*
head
){
int
l
ength
(
NODE
*
head
){
if
(
head
==
NULL
)
if
(
head
==
NULL
)
return
0
;
return
0
;
int
i
=
1
;
int
i
=
1
;
...
...
llist.h
View file @
1baf6dd5
...
@@ -18,9 +18,9 @@ NODE* search(int n, NODE *head);
...
@@ -18,9 +18,9 @@ NODE* search(int n, NODE *head);
NODE
*
construct
(
datatype
data
,
NODE
*
next
);
NODE
*
construct
(
datatype
data
,
NODE
*
next
);
NODE
*
traverse
(
NODE
*
head
,
int
pos
);
NODE
*
traverse
(
NODE
*
head
,
int
pos
);
int
delete_node_after
(
NODE
*
head
);
int
delete_node_after
(
NODE
*
head
);
NODE
*
Construct_L
ist
(
datatype
list
[],
int
size
);
NODE
*
construct_l
ist
(
datatype
list
[],
int
size
);
int
Add_To_E
nd
(
NODE
*
head
,
datatype
new_data
);
int
add_to_e
nd
(
NODE
*
head
,
datatype
new_data
);
int
Insert_N
ode
(
NODE
*
head
,
int
pos
,
datatype
new_data
);
int
insert_n
ode
(
NODE
*
head
,
int
pos
,
datatype
new_data
);
int
Insert_Node_A
fter
(
NODE
*
head
,
datatype
data
);
int
insert_node_a
fter
(
NODE
*
head
,
datatype
data
);
NODE
*
S
earch
(
NODE
*
head
,
datatype
data
);
NODE
*
s
earch
(
NODE
*
head
,
datatype
data
);
int
L
ength
(
NODE
*
head
);
int
l
ength
(
NODE
*
head
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment