My implementation of basement data structures in C#
Hello, my name is Artem. I decided to create my implementation of data structures which I use every day in my programming projects. List of data structures in this project:
- Stack
- Queue
- Linked list
- Double linked list (double-ended queue)
- Graphs (TODO)
- Trees (TODO)
- Prefix trees (TODO)
- Hash tables (TODO)
Stack
For stack, I used List type from System.Collections.Generic. What Stack class can do?
- int Size() - return size of a stack
- bool isEmpty() - check if stack is empty
- T Peek() - return top element of a stack without removing it
- void Push(T new_item) - add a new item on top of a stack (NOTE: top of a stack it is list element of a list)
- T Pop() - return top element of a stack and remove it
- Stack Reverse() - return stack with reversed elements order in a stack (turn a stack into a queue)
- Stack Copy() - return a deep copy of a stack
- void Sort() - sort values in this stack (bubble sort) TODO(another algorithm of sorting)!
Queue
For queue, I used List type from System.Collections.Generic. What Queue class can do?
- int Size() - return size of a queue
- bool isEmpty() - check if queue is empty
- T Top() - return top element of a queue without remowing it
- void Enqueue(T new_item) - add new item on the end of a queue
- T Dequeue() - return top element of a queue and remowe it
- void Reverse() - reverse elements order in a queue
- void Reverse(int n) - reverse first n-elements in a queue
- Queue Copy() - return a deep copy of a queue
- void Sort() - sort values in this queue (bubble sort) TODO(another alghorithm of sorting)!
- void Clear() - clear a queue
LinkedList
For a linked list I used List type from System.Collections.Generic. What LinkedList class can do?
- int Size() - return size of a linked list
- bool isEmpty() - check if linked list is empty
- T PeekHead() - return head element of a linked list without removing it
- T GetElement(int n) - return n-element of a linked list without removing it
- void PushBack(T item) - add a new item on the end of a linked list
- void PushStart(T item) - add a new item on the end of a linked list (but move the head pointer on it)
- T RemoveHead() - return value of a head element of a linked list and remove it
- T RemoveElement(int n) - return value of an n-element of a linked list and remove it
- void Reverse() - reverse elements order in a linked list
- LinkedList Copy() - return a deep copy of a linked list
- void Sort() - sort values in this linked (bubble sort) TODO(another algorithm of sorting)!
- void Clear() - clear a linked list
DoubleLinkedList
For a double linked list, I used List type from System.Collections.Generic. What DoubleLinkedList class can do?
- int Size() - return size of a linked list
- bool isEmpty() - check if linked list is empty
- T PeekHead() - return head element of a linked list without removing it
- T PeekTail() - return tail element of a linked list without removing it
- T GetElementFromStart(int id) - return n-element from start of a linked list without removing it
- T GetElementFromBack(int id) - return n-element from the back of a linked list without removing it
- void PushBack(T item) - add a new item on the end of a linked list
- void PushStart(T item) - add a new item on the end of a linked list (but move the head pointer on it)
- T RemoveHead() - return value of a head element of a linked list and remove it
- T RemoveTail() - return value of a tail element of a linked list and remove it
- T RemoveElementFromStart(int id) - return n-element from start of a linked list and remove it
- T RemoveElementFromBack(int id) - return n-element from back of a linked list and remove it
- void Reverse() - reverse elements order in a linked list
- DoubleLinkedList Copy() - return a deep copy of a linked list
- void Sort() - sort values in this linked (bubble sort) TODO(another algorithm of sorting)!
- void Clear() - clear a linked list