Professional Documents
Culture Documents
Final Project Pandemic 1.5'
Final Project Pandemic 1.5'
in
DATA STRUCTURES AND ALGORITHM
STACKS
TOPIC
Prepared by:
Jonathan C. Ilao
Jasmin Marie Layag
BSIT II-F2
STRATEGY IN TEACHING: PEER EVALUATION
DIRECTION: In this Pair Activity, you are going to create an idea or understanding
of the terms/ on the problem scenario below. Then you have to peek other 1 pair
from your classmates and ask them to listen and evaluate your reporting (about the
problem scenario below). Let them write/send a note to you regarding your
reporting. Take a screenshot/paste their comments/names in your answer sheet
then submit it to your Instructor.
NOTE: Don’t forget to take a screenshot of the collaboration together with your
Report.
Problem Scenario: Together with your pair, you are going to make a report and
choose a topic below.
TOPIC 1: What is STACK?
What are the two primary Operation in STACK?
What is peek(), isFull(), isEmpty()?
TOPIC 2:
Infix Notation
Prefix Notation
Postfix Notation
TOPIC 3:
Parsing Expression
Precedence
Associativity
What is STACK?
What is LIFO?
LIFO stands for Last-in-first-out.
• peek() − get the top data element of the stack, without removing it.
• isFull() − check if stack is full.
• isEmpty() − check if stack is empty.
6. Infix Notation – Operators are written between the operands. This is the
standard way of writing expressions. For example, A * (B + C) / D
Precedence
For example:
a + b *c -> a +(b*c)
Associativity
Associativity describes the rule where operators with the same precedence
appear in an expression. For example:
in expression a + b – c
STRATEGY IN TEACHING: MOTIVATED LEARNING
A. Multiple Choice
Direction : Choose the letter of the correct answer.
B. Enumeration
Direction : Answer the following question and explain briefly
1. B. LIFO
2. B. FIFO
3. Index 4 is out of range,because List 1 contain 4 items(Index 0 to 3 Only).
String is immutable type so we can’t change any character of string in place.
4. [10,20,30,40,70]
[10,20,30,40,70,100]
[10,20,30,40,70]
70
5. Stack
Queue
Stack
Stack
Queue
6. In a postfix expression, the operator is fixed after the operands. Some examples
are:
➢ B++ (i.e. B+B)
➢ AB+ (i.e. A+B)
➢ ABC*+ (i.e. A+B*C)
➢ AB*CD*+ (i.e. A*B + C*D)
7. A queue is a form of linear structure that follows the FIFO (First In First Out)
approach for accessing elements. Dequeue, enqueue, front, and rear are basic
operations on a queue. Like a stack, a queue can be implemented using arrays and
linked lists.
8.In a circular LinkedList, the last pointer points to the head (first node). For
this, we use an external pointer that points to the last node, and the last next
points to the first node. We take the last node pointer because it saves us from
traversing the entire list while inserting a node in the beginning or end.
6. Infix Notation – Operators are written between the operands. This is the
standard way of writing expressions. For example, A * (B + C) / D
7. Stack is a linear data structure that follows either LIFO (Last In First Out) or
FILO (First In Last Out) approach for accessing elements. Push, pop, and peek
are the basic operations of a stack.
WORKSHEETS
in
DATA STRUCTURES AND
ALGORITHM
ARRAY
TOPIC
Prepared by:
Jonathan C. Ilao
Jasmin Marie Layag
BSIT IIF2
WORKSHEET NO. 2
Direction : Create a simple program with class and method. .Do not forget the
sample output (witten or coded)
Note :
namespace Worksheet1
{
class bank
{
private double balance = 100000;
Console.WriteLine("------------------------------\n");
Console.WriteLine("Name of the depositor : " + name);
Console.WriteLine("Account Number: " + account);
Console.WriteLine("Total Balance amount in the account : " +tobal);
}
public void fun2()
{
Console.WriteLine("Enter Account Name :");
name = Console.ReadLine();
Console.WriteLine("Enter Account Number :");
account = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Withdraw Amount :");
withdraw = Convert.ToDouble(Console.ReadLine());
if (withdraw <= i.bal)
{
tobal = i.bal - withdraw;
Console.WriteLine("------------------------------\n");
Console.WriteLine("Account Name : " + name);
Console.WriteLine("Account Number: " + account);
Console.WriteLine("After Withdraw Amount balnace is : " + tobal);
}
else
Console.WriteLine("\n\nWithdraw Ammount does not Exist your Account.");
}
}
class Program
{
static void Main(string[] args)
{
char agn;
do
{
fuctions k = new fuctions();
int num;
Console.WriteLine("Please Select Any Function.");
Console.WriteLine("\nPress 1 for Deposit an Amount. \nPress 2 for Withdraw an
Amount.");
num = Convert.ToInt32(Console.ReadLine());
switch (num)
{
case 1:
k.fun1();
break;
case 2:
k.fun2();
break;
default:
Console.WriteLine("Invalid Selection!!!");
break;
}
Console.WriteLine("\nDo you want to continue this program? (y/n)");
agn =Convert.ToChar(Console.ReadLine());
Console.ReadKey();
}
}
}
OUTPUT:
WORKSHEET NO. 2 (LABORATORY :ANSWER)
using System;
namespace Worksheet2
class Course
coursecode = code;
courseDes = des;
numUnit = num;
apUnit = apu;
Console.WriteLine("\n---------Enrollment Receipt---------");
}
class Program
student.Display();
Console.ReadKey();
OUTPUT
WORKSHEET NO. 2 (LABORATORY :ANSWER)
zusing Encapsulation;
using System;
namespace Encapsulation
class PRODUCT
get
return Code;
set
Code = value;
get
return Description;
set
Description = value;
}
public int ProductQuantity
get
return Quantity;
set
Quantity = value;
get
return UnitPrice;
set
UnitPrice = value;
Console.WriteLine("============================================");
Console.WriteLine("================OFFICIAL RECEIPT============");
prod.Code = Console.ReadLine();
prod.Description = Console.ReadLine();
Console.Write("Quantity: ");
prod.Quantity = Convert.ToInt32(Console.ReadLine());
prod.UnitPrice = Convert.ToDouble(Console.ReadLine());
prod.Display();
Console.ReadKey();
OUTPUT :