Task - Implementing a Generic Class
You can clone the base code from the GithHub Repository.
A stack is a special kind of data structure which stores data according to the Last In, First Out (LIFO) principle. A stack has two main methods, namely, Push
and Pop
. The Push
adds a new element to the stack, and Pop
removes the most recently added element from the stack. You can imagine it like a stack of books, or any other item. By using Push
you add a new item on the top, and by using Pop
you remove the item at the top. This is the LIFO principle.
The program contains a class which implements the Stack data structure, however, it only supports integers. Make changes in the class code so that it is able to support any data type.
Tak for dine kommentarer!
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Awesome!
Completion rate improved to 3.7
Task - Implementing a Generic Class
Stryg for at vise menuen
You can clone the base code from the GithHub Repository.
A stack is a special kind of data structure which stores data according to the Last In, First Out (LIFO) principle. A stack has two main methods, namely, Push
and Pop
. The Push
adds a new element to the stack, and Pop
removes the most recently added element from the stack. You can imagine it like a stack of books, or any other item. By using Push
you add a new item on the top, and by using Pop
you remove the item at the top. This is the LIFO principle.
The program contains a class which implements the Stack data structure, however, it only supports integers. Make changes in the class code so that it is able to support any data type.
Tak for dine kommentarer!