This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01a98d0
commit 995f032
Showing
24 changed files
with
254 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,30 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
bool copyList(tlist L, tList *M) { | ||
tPosl p, q, r; | ||
bool ret = true; | ||
|
||
createEmptyList(M); | ||
if (!isEmptyList(L)) { | ||
p = L; | ||
while ((p != LNULL) && createNode(&r)) { | ||
r->data = p->data; | ||
r->next = LNULL; | ||
if (p == L) { | ||
*M = r; | ||
q = r; | ||
} else { | ||
q->next = r; | ||
q = r; | ||
} | ||
p = p->next; | ||
} | ||
if (p != LNULL) { | ||
deleteList(M); | ||
ret = false; | ||
} | ||
} | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void createEmptyList(tList *lista) { | ||
lista->indice = LNULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void deleteAtPosition(tPosL pos, tList *lista) { | ||
tPosl posAux; | ||
|
||
if (pos == *lista) | ||
*lista = (*lista)->next; | ||
else { | ||
for (posAux = *lista; posAux->next != pos; posAux = posAux->next); | ||
posAux->next = pos->next; | ||
} | ||
|
||
free(pos); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void deleteList(tList *lista) { | ||
tPosL posAux; | ||
while (*lista != LNULL) { | ||
posAux = *lista; | ||
*lista = (*lista)->next; | ||
free(posAux); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL findItem(tItem item, tList lista) { | ||
tPosL posAux; | ||
for (posAux = lista; (posAux != LNULL) && (posAux->data != item); posAux = posAux->next); | ||
return posAux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL first(tList lista) { | ||
return lista; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tItem getItem(tPosL pos, tList lista) { | ||
return pos->data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
bool isEmptyList(tLIst lista) { | ||
return lista == LNULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL last(tList lista) { | ||
tPosL posAux; | ||
for (posAux = lista; posAux->next != LNULL; posAux->next); | ||
return posAux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL next(tPosL pos, tList lista) { | ||
return pos->next; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL previous(tPosL pos, tList L) { | ||
tPosL posAux; | ||
for (posAux = L; posAux->next != pos; posAux = posAux->next); | ||
return posAux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void updateItem(tItem item, tPosL pos, tList *lista) { | ||
pos->data = item; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,30 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
bool copyList(tlist L, tList *M) { | ||
tPosl p, q, r; | ||
bool ret = true; | ||
|
||
createEmptyList(M); | ||
if (!isEmptyList(L)) { | ||
p = L; | ||
while ((p != LNULL) && createNode(&r)) { | ||
r->data = p->data; | ||
r->next = LNULL; | ||
if (p == L) { | ||
*M = r; | ||
q = r; | ||
} else { | ||
q->next = r; | ||
q = r; | ||
} | ||
p = p->next; | ||
} | ||
if (p != LNULL) { | ||
deleteList(M); | ||
ret = false; | ||
} | ||
} | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void createEmptyList(tList *lista) { | ||
lista->indice = LNULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void deleteAtPosition(tPosL pos, tList *lista) { | ||
tPosl posAux; | ||
|
||
if (pos == *lista) | ||
*lista = (*lista)->next; | ||
else { | ||
for (posAux = *lista; posAux->next != pos; posAux = posAux->next); | ||
posAux->next = pos->next; | ||
} | ||
|
||
free(pos); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void deleteList(tList *lista) { | ||
tPosL posAux; | ||
while (*lista != LNULL) { | ||
posAux = *lista; | ||
*lista = (*lista)->next; | ||
free(posAux); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL findItem(tItem item, tList lista) { | ||
tPosL posAux; | ||
for (posAux = lista; (posAux != LNULL) && (posAux->data != item); posAux = posAux->next); | ||
return posAux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL first(tList lista) { | ||
return lista; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tItem getItem(tPosL pos, tList lista) { | ||
return pos->data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
bool isEmptyList(tLIst lista) { | ||
return lista == LNULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL last(tList lista) { | ||
tPosL posAux; | ||
for (posAux = lista; posAux->next != LNULL; posAux->next); | ||
return posAux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL next(tPosL pos, tList lista) { | ||
return pos->next; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
tPosL previous(tPosL pos, tList L) { | ||
tPosL posAux; | ||
for (posAux = L; posAux->next != pos; posAux = posAux->next); | ||
return posAux; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// EN CONSTRUCCIÓN | ||
// COLABORA https://github.com/TeenBiscuits/Pro2324 | ||
// SPDX-FileCopyrightText: 2024 Eliana Reigada | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
void updateItem(tItem item, tPosL pos, tList *lista) { | ||
pos->data = item; | ||
} |