0% found this document useful (0 votes)
25 views13 pages

DS Assignment

The document outlines assignments for the Data Structure course for the academic year 2024-25, detailing various problems related to stacks, linked lists, trees, and graphs. Each assignment includes problem statements, links to online challenges, and course outcomes. The assignments cover a range of topics, including stack operations, cycle detection in linked lists, and Huffman coding.

Uploaded by

hrt
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)
25 views13 pages

DS Assignment

The document outlines assignments for the Data Structure course for the academic year 2024-25, detailing various problems related to stacks, linked lists, trees, and graphs. Each assignment includes problem statements, links to online challenges, and course outcomes. The assignments cover a range of topics, including stack operations, cycle detection in linked lists, and Huffman coding.

Uploaded by

hrt
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
You are on page 1/ 13

DEPARTMENT OF FIRST YEAR ENGINEERING

ACADEMIC YEAR 2024-25


Subject: Data Structure (CE01T)
Class: FE CMPN DIV A, B, C
Assignment #1: Stack
Problem Simple text editor
Statement #1

Problem Equal Stack Problem


Statement #2 You have three stacks of cylinders where each cylinder has the same
diameter, but they may vary in height. You can change the height of a stack
by removing and discarding its topmost cylinder any number of times.
Find the maximum possible height of the stacks such that all of the stacks
are exactly the same height. This means you must remove zero or more
cylinders from the top of zero or more of the three stacks until they are all
the same height, then return the height.
CO CO2
Links of https://www.hackerrank.com/challenges/simple-text-editor/problem?
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/equal-stacks/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #2: Stack
Problem Waiter Problem
Statement #1

Problem Game of two stacks


Statement #2 Alexa has two stacks of non-negative integers, stack and stack where
index denotes the top of the stack. Alexa challenges Nick to play the
following game:
 In each move, Nick can remove one integer from the top of either
stack or stack .
 Nick keeps a running sum of the integers he removes from the two
stacks.
 Nick is disqualified from the game if, at any point, his running sum
becomes greater than some integer given at the beginning of the
game.
 Nick's final score is the total number of integers he has removed
from the two stacks.
Given a, b, and maxsum for g games, find the maximum possible score Nick
can achieve.
CO CO2
Links of https://www.hackerrank.com/challenges/waiter/problem?isFullScreen=true
Problem
Statement https://www.hackerrank.com/challenges/game-of-two-stacks/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #3
Problem Truck Tour
Statement #1

Problem Queue using Two Stacks


Statement #2 A queue is an abstract data type that maintains the order in which elements
were added to it, allowing the oldest elements to be removed from the front
and new elements to be added to the rear. This is called a First-In-First-
Out (FIFO) data structure because the first element added to the queue (i.e.,
the one that has been waiting for the longest) is always the first one to be
removed.
A basic queue has the following operations:
 Enqueue: add a new element to the end of the queue.
 Dequeue: remove the element from the front of the queue and return
it.
CO CO2
Link of https://www.hackerrank.com/challenges/truck-tour/problem?
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/queue-using-two-stacks/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #4
Problem Down to zero problem
Statement #1

Problem Castle on the grid


Statement #2

CO CO2
Link of https://www.hackerrank.com/challenges/down-to-zero-ii/problem?
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/castle-on-the-grid/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #5
Problem Find merge points of two lists
Statement #1

Problem Compare two linked lists


Statement #2 You’re given the pointer to the head nodes of two linked lists. Compare the
data in the nodes of the linked lists to check if they are equal. If all data
attributes are equal and the lists are the same length, return 1. Otherwise,
return 0.
CO CO3
Links of https://www.hackerrank.com/challenges/find-the-merge-point-of-two-
Problem joined-linked-lists/problem?isFullScreen=true
Statement
https://www.hackerrank.com/challenges/compare-two-linked-lists/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #6
Problem Reverse doubly linked list
Statement #1

Problem Cycle Detection


Statement #2 A linked list is said to contain a cycle if any node is visited more than once
while traversing the list. Given a pointer to the head of a linked list,
determine if it contains a cycle. If it does, return 1. Otherwise, return 0.
CO CO3
Link of https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list/
Problem problem?isFullScreen=true
Statement
https://www.hackerrank.com/challenges/detect-whether-a-linked-list-
contains-a-cycle/problem?isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #7
Problem Self-balancing tree
Statement #1 An AVL tree (Georgy Adelson-Velsky and Landis tree, named after the
inventors) is a self-balancing binary search tree. In an AVL tree, the heights
of the two child subtrees of any node differ by at most one; if at any time
they differ by more than one, rebalancing is done to restore this property.

You are given a pointer to the root of an AVL tree. You need to insert a value
into this tree and perform the necessary rotations to ensure that it remains
balanced.
Problem Is this binary search tree
Statement #2 For the purposes of this challenge, we define a binary tree to be a binary
search tree with the following ordering requirements:
 The data value of every node in a node's left subtree is less than the
data value of that node.
 The data value of every node in a node's right subtree is greater
than the data value of that node.
Given the root node of a binary tree, can you determine if it's also a binary
search tree?
CO CO4
Link of https://www.hackerrank.com/challenges/self-balancing-tree/problem?
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/is-binary-search-tree/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #8
Problem Jenny’s Subtree
Statement #1

Problem Huffman Decoding


Statement #2 Huffman coding assigns variable length codewords to fixed length input
characters based on their frequencies. More frequent characters are assigned
shorter codewords and less frequent characters are assigned longer
codewords. All edges along the path to a character contain a code digit. If
they are on the left side of the tree, they will be a 0 (zero). If on the right,
they'll be a 1 (one). Only the leaves will contain a letter and its frequency
count. All other nodes will contain a null instead of a character, and the
count of the frequency of all of it and its descendant characters.
CO CO4
Link of https://www.hackerrank.com/challenges/jenny-subtrees/problem?
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/tree-huffman-decoding/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #9
Problem Palindromic Subsets
Statement #1

Problem Contacts
Statement #2 We're going to make our own Contacts application! The application must
perform two types of operations: add name, where name is a string denoting
a contact name. This must store name as a new contact in the application.
find partial, where partial is a string denoting a partial name to search the
application for. It must count the number of contacts starting with partial and
print the count on a new line.
Given n sequential add and find operations, perform each operation in order.
CO CO5
Link of https://www.hackerrank.com/challenges/palindromic-subsets/problem?
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/contacts/problem?isFullScreen=true

Assignment #10
Problem Kindergarten Adventures
Statement #1
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25

Problem Component in a graph


Statement #2 There are 2 X N nodes in an undirected graph, and a number of edges
connecting some nodes. In each edge, the first value will be between 1 and
N, inclusive. The second node will be between N+1 and 2 X N, inclusive.
Given a list of edges, determine the size of the smallest and largest
connected components that have 2 or more nodes. A node can have any
number of connections. The highest node value will always be connected to
at least 1 other node.
Note Single nodes should not be considered in the answer.

CO CO5
Link of https://www.hackerrank.com/challenges/kindergarten-adventures/problem?
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/components-in-graph/problem?
isFullScreen=true
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
Assignment #11
Problem Mr. X and his shots
Statement #1

Problem Find maximum index product


Statement #2

CO CO6
Links of https://www.hackerrank.com/challenges/x-and-his-shots/problem?
Problem isFullScreen=true
Statement
https://www.hackerrank.com/challenges/find-maximum-index-product/
DEPARTMENT OF FIRST YEAR ENGINEERING
ACADEMIC YEAR 2024-25
problem?isFullScreen=true

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy