0% found this document useful (0 votes)
4 views3 pages

Dsa Tutorial 1

The document outlines five scenarios involving different programming challenges. Scenario 1 involves calculating the product of parcel labels from 1 to N, Scenario 2 checks for matching symbols in a code snippet, Scenario 3 translates expressions into a specific format, Scenario 4 updates a music playlist, and Scenario 5 manages task removal from a scheduler. Each scenario includes a problem statement, input format, and sample input/output.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Dsa Tutorial 1

The document outlines five scenarios involving different programming challenges. Scenario 1 involves calculating the product of parcel labels from 1 to N, Scenario 2 checks for matching symbols in a code snippet, Scenario 3 translates expressions into a specific format, Scenario 4 updates a music playlist, and Scenario 5 manages task removal from a scheduler. Each scenario includes a problem statement, input format, and sample input/output.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Scenario 1: Parcel Counter

Problem Statement:
A warehouse stores parcels in a vertical container. Parcels are added one on top of another
and must be removed in the reverse order of insertion.
Given a number N, representing the number of parcels, determine the product of all parcel
labels from 1 to N.

Input Format:
An integer N.

Output Format:
Print the product of numbers from 1 to N.

Sample Input:

Sample Output:

24

Scenario 2: Code Compiler Check


Problem Statement:
A compiler checks whether every opening symbol in a program has a corresponding closing
symbol in the correct order.
Given a code snippet as a string, determine whether it passes the compiler check.

Input Format:
A string containing {}, [], and ().

Output Format:
Print VALID or INVALID.

Sample Input:

{(a+b)*[c-d]}

Sample Output:

VALID
Scenario 3: Expression Translator
Problem Statement:
A calculator accepts expressions only in a special format where operators come after
operands.
Given an expression written in human-readable form, convert it into the format accepted by the
calculator.

Input Format:
A string representing an arithmetic expression.

Output Format:
Print the converted expression.

Sample Input:

A*(B+C)

Sample Output:

ABC+*

Scenario 4: Music Playlist Update


Problem Statement:
A music player maintains a playlist where songs can be added:

● at the beginning

● at the end

● at a specific position

Perform the requested update and display the playlist.

Scenario 5: Task Removal System


Problem Statement:
A task scheduler removes tasks from a list based on user request:

● first task

● last task

● task at a given position

Display the updated task list.

You might also like