0% found this document useful (0 votes)
66 views5 pages

OOPDS C++ Projecf

The document provides instructions for a programming project involving data structures. Students are to write an object-oriented program implementing various data structures and their associated operations. The program must support linked lists, stacks, queues, binary search trees and allow for defining variables and performing arithmetic operations. Examples of expected functionality and sample output are provided. The deadline to submit the project is Week 15 of the trimester.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views5 pages

OOPDS C++ Projecf

The document provides instructions for a programming project involving data structures. Students are to write an object-oriented program implementing various data structures and their associated operations. The program must support linked lists, stacks, queues, binary search trees and allow for defining variables and performing arithmetic operations. Examples of expected functionality and sample output are provided. The deadline to submit the project is Week 15 of the trimester.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

TCP1201 Object Oriented Programming and Data Structures

Trimester 1-2022/2023

Project
Data Structure Programming Language

1. Deadline
To be submitted by 5:00PM on Monday of Week 15 of the trimester.

3. Grouping
To be done in a group of 3 to 4 students in any Tutorial Section, STRICTLY NO COPYING from other
groups. You are required to register your group on MMLS latest by 5:00pm Monday 7th of November,
2022.

4. Software Functional Requirements


You are expected to write a complete OO program to implement the following DS language explained
in the following tables.

Data Purpose Instruction Set


Structure
General Create a named data structure Var <DS type> <Data type> <DS Name>
Delete a named data structure delete <DS Name>
Display contents of DS print <DS Name>
Search for an element search <DS Name> <value>
Sort the elements sort <sorting method> <Ascend/Descend> <DS
name>
Clone a data structure clone <DS name> <new data structure name>
Variables & Declare a variable Var <var type> <var name>
operations Assign value to variable = <var> <value>
Assign var1 to var = <var> <var1>
Results are Add a value to a var + <var> <value>
always Add a var1 to a var + <var> <var1>
stored var Subtract value from a var - <var> <value>
which is Subtract var1 from a var - <var> <var1>
directly to Multiply var and value * <var> <value>
the right of Multiply var and var1 * <var> <var1>
the operator Divide var by value / <var> <value>
Divide var by var1 / <var> <var1>
Mod var by value % <var> <value>
Mod var by var1 % <var> <var1>
Print variable name print <var>
if boolean variable true print if <bool var> #message#
message
if boolean variable not true print !if <bool var> #message#
message
Single Add node to the end AddE <DS Name> <value>
Linked List Delete a node from the end DelE <DS Name>
Add node to the front AddF <DS Name> <value>
DS Type = Delete a node from the front DelF <DS Name>
SLL insert value after a node AddA <DS Name> <node value> <value>
Point to the beginning of the list PtrStart <DS Name> <PTR Name>
Get the value at a pointer and store getNode <var> <PTR Name>
it in var
Move the pointer forward nextNode <PTR name>
Check if ptr reached the end of list isEnd <PTR Name> <res>
if boolean variable true print if <res> #message#
message
if boolean variable not true print if! <res> #message#
message

Double Add node to the end AddE <DS Name> <value>


Linked List Delete a node from the end DelE <DS Name>
Add node to the front AddF <DS Name> <value>
DS Type = Delete a node from the front DelF <DS Name>
DLL insert value after a node AddA <DS Name> <node value> <value>
Point to the beginning of the list PtrStart <DS Name> <PTR Name>
Point to the end of the list PtrEnd <DS Name> <PTR Name>
Get the value at a pointer and store getNode <var> <PTR Name>
it in var
Move the pointer forward nextNode <PTR name>
Move the pointer backword prevNode <PTR name>

Check if ptr reached the end of list isEnd <PTR Name> <res>
if end → res = true otherwise false

Check if ptr reached the head of isHead <PTR Name> <res>


list
if end → res = true otherwise false

Stack Push item to stack Push <DS Name> <value|var>


Pop an item from the stack Pop <Ds Name>
DS Type = (remove)
Stack
Return the top of the stack (no Top <DS Name> <var>
remove)

check if full setting <bool var> to isFull <DS Name> <bool var>
true otherwise to false

check if empty setting <bool var> isEmpty <Ds Name> <bool var>
to true otherwise to false
Queue Add item to queue Push <Q Name> <value|var>
pop an item from the queue Pop <Q Name>
DS Type = return the front of the queue front <Q Name> <var>
Queue return the back of the queue back <Q Name> <var>
check if full setting <bool var> to isFull <Q Name> <bool var>
true otherwise false
check if empty setting <bool var> isEmpty <Q Name> <bool var>
to true otherwise false

Binary Add item to tree Insert <BST Name> <value|var>


Search Tree delete an item from the tree delete <BST Name> <value>
return the root of the tree root <BST Name> <var>
DS Type = traverse the tree (in-order) inorder <BST Name>
BST traverse the tree (post-order) postorder <BST Name>
traverse the tree (pre-order) preorder <BST Name>

Data type
Integer data type integer
Float or double data type real
Boolean data type bool
Pointer data type pointer

Data Structure type


Single Linked List SLL
Double linked list DLL
Stack Stack
Queue Queue
Binary Search Tree BST
Vector Vec
Example programs

Some examples and their expected output are given too. More examples will be discussed in the class
and the extra lectures given every Tuesday and Friday from 8-10PM.

Var SLL integer s 10:9:16


AddE s 10
AddE s 9
AddE s 16
print s
delete s
Var SLL integer s 20:10:7
AddF s 10 not yet
AddF s 20 37
AddE s 7
print s
Var integer sum
Var integer x
Var pointer ptr
Var bool ddd
= sum 0
ptrStar s ptr
getNode x ptr
nextNode ptr
+ sum x
getNode x ptr
nextNode ptr
+ sum x
checkEnd ptr ddd
if ddd #not yet#
getNode x ptr
nextNode ptr
+ sum x
print sum
delete s
delete x
delete sum
delete ptr
Var int x 20:9:10
Var Stack st stack is not empty
push st 10 10
push st 9
push st 20
print st
top st x
print x
isEmpty st x
if x #stack is not empty#
pop st
pop st
print st
delete x
delete st
Var BST b 7:10:20
insert b 10
insert b 20
insert b 30
insert b 7
delete b 30
inorder b
delete b

You might also like