[SOLVED] Java (CSCI 251) Project Three: Implement a stack using Singly Linked List

$25

File Name: Java_(CSCI_251)_Project_Three:_Implement_a_stack_using_Singly_Linked_List.zip
File Size: 687.66 KB

5/5 - (1 vote)

(CSCI 251) Project Three: Implement a stack using Singly Linked List
Project Description:
In this project, the students are required to implement a stack using single linked list concept. All the single linked list operations performed are based on Stack operations LIFO (last in first out) and with the help of that knowledge you are going to implement a stack using single linked list.
Remember, when we use a single linked list, we are storing the information in the form of nodes. Now in order to do this assignment, we also need to follow the stack rules. So, the following are the rules:
1. last in first out
2. use a top variable
3. to insert the elements, use stack operations
See the following example diagram.

A stack can be easily implemented through the linked list. In stack Implementation, a stack contains a top pointer. which is head of the stack where pushing and popping items happens at the head of the list. The first node (remember first-in concept, so the first node is the bottom of the container) has null in link field and second node link have first node address in link field and so on and last node address in top pointer. See the above example.
The main advantage of using linked list over an array is that it is possible to implements a stack that can shrink or grow as much as needed. An array will put a restriction to the maximum capacityofthearraywhichcanleadtostackoverflow. Hereeachnewnodewillbedynamically allocated, so overflow is not possible.
Two files are given: MyStack.cpp and MyStack.java. These are templates for your project. Please do not change the function names. You are to use this file to implement the code within the functions. Depending on the language you wish to do the assignments, you can either choose the .cpp or the .java file.
Due Date: To be announced on blackboard.
Stack Operations:
1. Push() : Insert the element into linked list nothing but which is the top node of Stack. 2. Pop() : Return top element from the Stack and move the top pointer to the second node
of linked list or Stack.
3. peek(): Return the top element.
4. display(): Print all element of Stack.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Java (CSCI 251) Project Three: Implement a stack using Singly Linked List
$25