32
Level 1 DBDS 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. Simple representation of a stack Group Assignment Page 1

documentation final dbds

Embed Size (px)

Citation preview

Page 1: documentation final dbds

Level 1 DBDS

IntroductionThis 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.

Simple representation of a stack

The two operations applicable to all stacks are:

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.

Group Assignment Page 1

Page 2: documentation final dbds

Level 1 DBDS

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:-

Add a new node to the end Add a new node to the beginning Print out the entire list Remove a node from the list Quit the program

Group Assignment Page 2

Page 3: documentation final dbds

Level 1 DBDS

LINK LIST (with Screen Shots)

In this program there are four functions:

Add at the beginning

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.

Add node at the end

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.

. Remove the node

This function will remove the node from any side of the list either at the beginning or end of list.

Print lists

This function will print the entire lists

In the user interface there are options in menu to select the different choices, the options are as

follow as:-

Add a new node to the beginning.

Add a new node to the end.

Print out the entire list.

Remove a node from the list.

Quit the program.

Group Assignment Page 3

Page 4: documentation final dbds

Level 1 DBDS

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:-

Group Assignment Page 4

Page 5: documentation final dbds

Level 1 DBDS

Validation for main menu

Sometime user may enter irrelevant choice in that case one message will appear as INVALID CHOICE ENTERED, PLEASE ENTER AGAIN.

Group Assignment Page 5

Page 6: documentation final dbds

Level 1 DBDS

Add a new record at the beginning

As soon as the user will enter the first option he will asked for customer, customer name, number, customer description. And finally the record will be added at very first of list.

Group Assignment Page 6

Page 7: documentation final dbds

Level 1 DBDS

VALIDATION FOR CUSTOMER NAME

As soon as the user will enter the incorrect data format .then a message will be display that

INVALID ENTREY PLEASE ENTER VALID NAME.

Group Assignment Page 7

Page 8: documentation final dbds

Level 1 DBDS

VALIDATION FOR CUSTOMER NUMBER

As soon as user will enter the incorrect data format .then a message will be display that

INVALID ENTREY PLEASE ENTER VALID NAME

Group Assignment Page 8

Page 9: documentation final dbds

Level 1 DBDS

Add a new record at the end

As soon as the user will enter the second option he will asked for customer, customer name, number, customer description. And finally the record will be added at end of list.

Group Assignment Page 9

Page 10: documentation final dbds

Level 1 DBDS

Print entire records

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.

Group Assignment Page 10

Page 11: documentation final dbds

Level 1 DBDS

Remove a record from the list

As soon as the user will enter the fourth option he will asked for DELETE THE RECORD BY CUSTOMER NAME, CUSTOMER NUMBER.

Group Assignment Page 11

Page 12: documentation final dbds

Level 1 DBDS

Remove the records by using customer Name

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.

Group Assignment Page 12

Page 13: documentation final dbds

Level 1 DBDS

Remove the Record by customer Number

As soon as the user will enter the incorrect option for removing the recors then the message will display that option in the remove a node from the list the record will be deleted by customer number.

Group Assignment Page 13

Page 14: documentation final dbds

Level 1 DBDS

Validation for Removing the Record

Group Assignment Page 14

Page 15: documentation final dbds

Level 1 DBDS

After removing all records

After removing all the records by customer name and customer numberAs 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.

Exit from program

Group Assignment Page 15

Page 16: documentation final dbds

Level 1 DBDS

As soon as the user will enter fifth option he will exit from the program.

STACK(with Screen Shots)

Group Assignment Page 16

Page 17: documentation final dbds

Level 1 DBDS

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.

In the present program there are following menu provided

Load the truck Load the stacker Load the robot Load the bin

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.

Validation for wrong choice

Group Assignment Page 17

Page 18: documentation final dbds

Level 1 DBDS

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

Group Assignment Page 18

Page 19: documentation final dbds

Level 1 DBDS

The user enters 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

Group Assignment Page 19

Page 20: documentation final dbds

Level 1 DBDS

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

Group Assignment Page 20

Page 21: documentation final dbds

Level 1 DBDS

When the user enters choice 2 then this screen appears which shows what elements are there in the warehouse.

Validation for wrong BIN ID

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

Group Assignment Page 21

Page 22: documentation final dbds

Level 1 DBDS

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.

Validation for empty warehouse

Group Assignment Page 22

Page 23: documentation final dbds

Level 1 DBDS

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

Page 24: documentation final dbds

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

Page 25: documentation final dbds

Level 1 DBDS

Reference of books

BIBLIOGRAPHY Kanetkar, Y. P. (2005). Let us C (6th ed.). New Delhi: BPB Publication.

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

Reference of web sites http://www.amazon.com as accessed on 15th March 2008 at 1:00 p.m http://www.google.co.in as accessed on 20th March at 4:00 p.m

Other references

Powerpoint slide of APIIT SD INDIA, Semester –4,Sub- Data Structure using C, as accessed on 23rd March, 2008

Workload Matrix

Group Assignment Page 25

Page 26: documentation final dbds

Level 1 DBDS

TOPIC Group Member (Effort (%))

Sneha

Thakur

Nainy Alok Nath Sharma

Ashish Bhardwaj

1. Introduction to the project 25% 25% 25% 25%

2. Workload matrix 25% 25% 25% 25%

3. Source- Codes 25% 25% 25% 25%

4. Screens design 25% 25% 25% 25%

5. Testing 25% 25% 25% 25%

5.References 25% 25% 25% 25%

6. Group Effort 25% 25% 25% 25%

Group Assignment Page 26