/Data-Structure

Linked Lists, Queue, Stacks

Primary LanguageC#

Data-Structure

Linked Lists, Queue, Stacks

Challenge πŸ”¨

You are required to recreate the Generic classes for:

πŸ“Œ Singly Linked list

πŸ“Œ Stack

πŸ“Œ Queue

Functional Requirements πŸ”§

πŸ“ The Stack class should have the following methods

βœ… IsEmpty() - returns true if the stack is empty and false is it isn’t

βœ… Push(T item) – adds an item to the top of the stack

βœ… Pop() – removes and returns the last item added to the stack

βœ… Peek() - returns the last item added to the stack

βœ… Size() - shows the number of items currently in the stack

πŸ“ The Queue class should have the following methods:

βœ… IsEmpty() - returns true if the queue is empty and false is it isn’t

βœ… Enqueue(T item) – adds an item to the tail of the queue

βœ… Dequeue() - removes and returns the item at the head of the queue

βœ… Size() - shows the number of items currently in the queue

πŸ“ The LinkedList class should have the following methods:

βœ… Add(T item) - adds an item to the tail of the LinkedList and returns the linked list’s size

βœ… Remove(T item) - removes the first occurrence of an item in the linked list, returns true if said item is found and removed or returns false otherwise

βœ… Check(T item) - checks for a specified item in the linked list. Returns a Boolean

βœ… Index(T item) - returns the index of an item or returns -1 if the item isn’t found