Code Monkey home page Code Monkey logo

listaslibrary's Introduction

Listas library 📚

Libreria de listas implementadas en C.

Instrucciones para ejecutar

  • Linux
gcc main.c -o nombrePrograma && nombrePrograma
  • Windows
gcc .\main.c -o nombrePrograma ; .\nombrePrograma

Estructura del nodo de la lista

typedef struct node
{
	char name[20];
	int value;
	struct node *next;
} Node;

Estructura d enodo Dividiendose este en

  • Nombre: Elemento de tipo char[20] para guardar cadenas de texto
  • Valor: Elemento de tipo int, para guardar numeros
  • Next: Direccion del proximo nodo
graph LR
A[nombre:valor ] -->B[char 20 => nombre ]
A --> C[int => valor ]

Funciones que puede realizar

1. Anadir un elemento al inicio

Agrega un elemento justo al inicio de la lista

Antes

graph LR
A[Elemento 1 ] --> B[Elemento 2]

Despues

graph LR
C[Elemento nuevo]--> A[Elemento 1 ] --> B[Elemento 2]

2. Anadir un elemento al final

Agrega un elemento justo al final de la lista

Antes

graph LR
A[Elemento 1 ] --> B[Elemento 2]

Despues

graph LR
A[Elemento 1 ] --> B[Elemento 2] --> C[Elemento nuevo]

3. Invertir la Lista

*Invierte la direccion en la que apuntan los elementos d ela lista *

Antes

graph LR
A[Elemento 1 ] --> B[Elemento 2] --> C[Elemento 3]

Despues

graph LR
A[Elemento 1]
B[Elemento 2]
C[Elemento 3] -->B -->A

4. Copiar la lista a una nueva

Permite crear una nueva lista apartir de otra

Antes

  • Lista 1:
graph LR
A[Elemento 1 ] --> B[Elemento 2] --> C[Elemento 3]

Despues

  • Lista 1:
graph LR
A[Elemento 1 ] --> B[Elemento 2] --> C[Elemento 3]
  • Lista 2:
graph LR
A[Elemento 1 ] --> B[Elemento 2] --> C[Elemento 3]

5. Imprimir la lista

Permite leer los lementos de la lista en consola

Teniendo

graph LR
A[Elemento 1 ] --> B[Elemento 2] --> C[Elemento 3]

Salida en consola

Elemento 1:Valor1 --> Elemento 2:Valor2 --> Elemento 3:Valor3

6. Concatenar las dos listas

Permite unir 2 listas Antes

  • Lista 1:
graph LR
A[Elemento 1 ] --> B[Elemento 2] 
  • Lista 2:
graph LR
A[Elemento 3 ] --> B[Elemento 4] --> C[Elemento 5]

Despues

  • Lista resultante:
graph LR
A[Elemento 1] --> B[Elemento 2] --> C[Elemento 3] --> D[Elemento 4] --> E[Elemento 5]

Otras funciones de las que dispone

in_counter(Node *listp): Cuenta el numero de 
nodos de una lista 
free_all(Node *listp): libera la memoria de una lista 
del_item(Node *listp, char *name): elimina la primera 
ocurrencia de name y retorna la nueva lista
is_empty(Node *listp): retorna 1 si esta vacia, 
0 en caso contrario

Autores ✒️

listaslibrary's People

Contributors

alfonzzoj avatar

Stargazers

Liam  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.