Documente Academic
Documente Profesional
Documente Cultură
Introduction
This assignment deals with two sections namely the link list and the stack. This introduction part
will discuss about these two topics in general and the rest of the documentation will discuss what
the assignment is all about.
1. Stack
Stack is an abstract data type and data structure based on the principle of Last In First Out
(LIFO). Stacks are used extensively at every level of a modern computer system. Stacks are used
to run a Java Virtual Machine, and the Java language itself has a class called "Stack", which can
be used by the programmer. The stack is ubiquitous.
A stack is usually represented in computers by a block of memory cells, with the "bottom" at a
fixed location, and the stack pointer holding the address of the current "top" cell in the stack. The
top and bottom terminology are used irrespective of whether the stack actually grows towards
lower memory addresses or towards higher memory addresses.
PUSH:-
A push operation, in which a data item is placed at the location pointed to by the stack
pointer, and the address in the stack pointer is adjusted by the size of the data item;
POP
A pop or pull operation: a data item at the current location pointed to by the stack pointer
is removed, and the stack pointer is adjusted by the size of the data item.
2. Link List
Linked list is one of the fundamental data structures, and can be used to
implement other data structures.
It consists of a sequence of nodes, each containing arbitrary data fields and one or
two references ("links") pointing to the next and/or previous nodes.
The principal benefit of a linked list over a conventional array is that the order of
the linked items may be different from the order that the data items are stored in
memory or on disk, allowing the list of items to be traversed in a different order.
A linked list is a self-referential data type because it contains a pointer or link to
another datum of the same type.
Linked lists permit insertion and removal of nodes at any point in the list in
constant time, but do not allow random access. Several different types of linked
list exist: singly-linked lists, doubly-linked lists, and circularly-linked lists.
A singly-linked list
The various operations which we need to use in this assignment and that are applicable to all link
lists are as follows:-
This function adds a node to the beginning of the linked list. The node added is the first nod then
the node becomes the first node else the node that is added is becomes the node that proceed all
the nodes.
This function will add a node at the end of the list. When this function will be called it will check
whether it is the first node or there is more than one node. If it is the first node then the first
node will be last node , and if there is more than one node in the list then the coming node will
be add at last of existing node in the list.
This function will remove the node from any side of the list either at the beginning or end of list.
Print lists
In the user interface there are options in menu to select the different choices, the options are as
follow as:-
Main Menu:-
The main menu will provide the user to ease in using the program features. The menu opens with
the five options for the users and asks for enter user choice as shown below:-
Sometime user may enter irrelevant choice in that case one message will appear as INVALID
CHOICE ENTERED, PLEASE ENTER AGAIN.
As soon as the user will enter the incorrect data format .then a message will be display that
INVALID ENTREY PLEASE ENTER VALID NAME.
As soon as user will enter the incorrect data format .then a message will be display that
INVALID ENTREY PLEASE ENTER VALID NAME
As soon as the user will enter the third option al the records will de display on the interface with
corresponding customer name, customer number, and customer description.
As soon as the user will enter the first option in the remove a node from the list the
record will be deleted by customer name.
After removing all the records by customer name and customer number
As soon as the user will enter the first option in the remove a node from the list the record
will be deleted by customer name.
As soon as the user will enter fifth option he will exit from the program.
Stack is an implication of storing data in an array. In a stack a value is always stored at the
lowermost location available. If there is no location available then no value is added in the stack.
The message is displayed that the stack is full.
MAIN MENU
This is the main menu which is displayed at the very beginning when the program is compiled.
This menu asks the user to enter any choice between 1 and 4 and the options have been provided
in the interface.
If the user enters any other choice other than 1, 2, 3 and 4 then there is a validation that “it is
invalid choices please enter again”.
For Choice 1
The user enters the size of Merchandize as 2 then two times it asks to enter the BIN ID and The
ITEM ID and the user needs to enter both the values for the given no. of merchandize.
Next Step
When the user enters the BIN ID and the ITEM ID for all the merchandizes then this screen
appears which shows what elements does the stacker contains.
Further when the user presses enter key then this screen appears which shows what elements do
the robot contains.
For Choice 2
When the user enters choice 2 then this screen appears which shows what elements are there in
the warehouse.
If the user enters the BIN ID other than 0-4 then a message is displayed that it is an invalid entry.
For option 3
If the user enters choice 3 then this screen appears which asks the user to enter the Bin ID.
Depending on what BIN ID the user has entered the item is retrieved from the warehouse and the
following output is displayed.
If the user enters choice 2 and there is no item in the warehouse then a message will appear
which says that the warehouse is empty.
For Exit
If the user enters choice 4 then it will exit from the program.
Conclusion
Group Assignment Page 23
Level 1 DBDS
After completing this project we can conclude that we have gained enough knowledge about
what is a stack and a linked list. The various operations performed on both the stack as well as
linked list is also very much clear to us. This assignment has enhanced our justifications which
we previously had about stacks and linked list. The practical approach of the module, Data
Structure has helped us in solving the questions of stack and linked lists in a more effective and
an efficient way. We are now in a state where we can solve all the queries related to these two
topics to the best of our knowledge. We have given the best validations which we could give in
both the topic. The entire effort has been made by all the group members.
Thus we would like to conclude that this assignment has been a lot of importance to us as it has
given us the best knowledge of stacks and linked lists.
References
Group Assignment Page 24
Level 1 DBDS
Reference of books
Lipschutz, S., & Pai, G. A. (2008). Data Structures (2006 Edition ed.). New Delhi: Tata
McGraw-Hill.
Srivastava, K. S., & Srivastava, D. (2005). C in Depth. New Delhi: BPB Publication.
Deital, H., & Deital, P. (2001). C How to Program. Delhi: Pearson Education.
Standard C String and Character. (n.d.). Retrieved March 26, 2008, from Cppreference:
http://www.cppreference.com/stdstring/index.html
Yedidyah Langsman,(2001) Data Structure using C and C++.New Delhi:PHI Publication
Other references
Workload Matrix