|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Linked list implementation using Arrays. More...
#include <iostream>Classes | |
| class | Node |
Functions | |
| void | initialise_list () |
| int | getnode () |
| void | freeNode (int nodeToBeDeleted) |
| void | insertAtTheBeginning (int data) |
| void | insertAtTheEnd (int data) |
| void | display () |
| int | main () |
Variables | |
| Node | AvailArray [100] |
| array that will act as nodes of a linked list. | |
| int | head = -1 |
| int | avail = 0 |
Linked list implementation using Arrays.
The difference between the pointer implementation of linked list and array implementation of linked list:
| void display | ( | ) |
| void freeNode | ( | int | nodeToBeDeleted | ) |
This function when called will delete the node with the index presented as an argument, and will put back that node into the array.
| int getnode | ( | ) |
This will return the index of the first free node present in the avail list
| void initialise_list | ( | ) |
| void insertAtTheBeginning | ( | int | data | ) |
The function will insert the given data into the front of the linked list.
| void insertAtTheEnd | ( | int | data | ) |
| int main | ( | void | ) |
Main function