You are on page 1of 13

Course TITLE OF THE COURSE L T P S C CH Course Type*

Code Advance Programming Lab – II 0 0 2 0 1 2 EE

21CSP- Course Code(s)


351/21ITP- 21CSP-351//21ITP-
351 351
PRE- Basics of C, C++, Data Structure
REQUISITE
CO- Data Structure
REQUISITE
ANTI- -
REQUISITE

a. Course Description
Advance programming is the course in which students will learn how to apply algorithms in order
to solve complex problems. The goal of this course is to teach students how to apply familiar
algorithms to non-intuitive problems.

b. Course Objectives
 To give students the ability to write reliable codes.
 To provide skills to the students to write compact and efficient code in a quick manner
 To provide logic building capability to the student.
 To improve the logic building of students to tackle the complex problems.
 To implement the different approaches to get appropriate solutions.

c. Course Outcomes
CO1 Understand the problem and find out a better approach to solve a particular problem.
CO2 Apply the knowledge of the programming concept to develop small programs for specific
problems.
CO3 Illustrating basic algorithmic challenges through programs, encompassing concepts such as
stacks, queues, linked lists, tree traversals, graph traversals, hashing, and the calculation of
shortest paths.
CO4 Analyze the appropriate approaches for specific problems and achieve all test cases.
CO5 Create an outcome-based mini-project or idea as a solution for society.

d. Syllabus

Unit-1 Data Structures Contact Hours:15


Arrays, 1. Problem statement - Given an integer array nums, return all the triplets
Stacks, Queues [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j]
linked list + nums[k] == 0.Notice that the solution set must not contain duplicate triplets.
Problem link- https://leetcode.com/problems/3sum/
2. Problem statement - You are given a 0-indexed array of integers nums of
length n. You are initially positioned at nums[0].
Each element nums[i] represents the maximum length of a forward jump from
index i. In other words, if you are at nums[i], you can jump to any nums[i + j]
where:
0 <= j <= nums[i] and
i+j<n
Return the minimum number of jumps to reach nums[n - 1]. The test cases are
generated such that you can reach nums[n - 1].
Problem link- https://leetcode.com/problems/jump-game-ii/
3. Problem statement - Given a string path, which is an absolute path (starting
with a slash '/') to a file or directory in a Unix-style file system, convert it to the
simplified canonical path.
In a Unix-style file system, a period '.' refers to the current directory, a double
period '..' refers to the directory up a level, and any multiple consecutive slashes
(i.e. '//') are treated as a single slash '/'. For this problem, any other format of
periods such as '...' are treated as file/directory names.
The canonical path should have the following format:
The path starts with a single slash '/'.
Any two directories are separated by a single slash '/'.
The path does not end with a trailing '/'.
The path only contains the directories on the path from the root directory to
the target file or directory (i.e., no period '.' or double period '..')
Return the simplified canonical path.
Problem link- https://leetcode.com/problems/simplify-path/
4. Problem statement - Implement a first in first out (FIFO) queue using only
two stacks. The implemented queue should support all the functions of a
normal queue (push, peek, pop, and empty).
Implement the MyQueue class:
void push(int x) Pushes element x to the back of the queue.
int pop() Removes the element from the front of the queue and returns it.
int peek() Returns the element at the front of the queue.
boolean empty() Returns true if the queue is empty, false otherwise.
Problem link- https://leetcode.com/problems/implement-queue-using-
stacks/
5. Problem statement - You are given the heads of two sorted linked lists list1
and list2.Merge the two lists into one sorted list. The list should be made by
splicing together the nodes of the first two lists. Return the head of the merged
linked list.
Problem link- https://leetcode.com/problems/merge-two-sorted-lists/
6. Problem statement - Given the head of a sorted linked list, delete all nodes
that have duplicate numbers, leaving only distinct numbers from the original
list. Return the linked list sorted as well.
Problem link- https://leetcode.com/problems/remove-duplicates-from-
sorted-list-ii/
String Matching 1. Problem statement - Given two strings s and goal, return true if and only if s
can become goal after some number of shifts on s.
A shift on s consists of moving the leftmost character of s to the rightmost
position.
For example, if s = "abcde", then it will be "bcdea" after one shift.
Problem link- https://leetcode.com/problems/rotate-string/
2. Problem statement - Given two strings needle and haystack, return the
index of the first occurrence of needle in haystack, or -1 if needle is not part
of haystack.
Problemlink-https://leetcode.com/problems/find-the-index-of-the-first-
occurrence-in-a-string/
3. Problem statement - Given an array of strings queries and a string pattern,
return a boolean array answer where answer[i] is true if queries[i] matches
pattern, and false otherwise.
A query word queries[i] matches pattern if you can insert lowercase English
letters pattern so that it equals the query. You may insert each character at any
position and you may not insert any characters.
Problem link- https://leetcode.com/problems/camelcase-matching/
4. Problem statement - Given two strings a and b, return the minimum number
of times you should repeat string a so that string b is a substring of it. If it is
impossible for b to be a substring of a after repeating it, return -1.
Notice: string "abc" repeated 0 times is "", repeated 1 time is "abc" and
repeated 2 times is "abcabc".
Problem link- https://leetcode.com/problems/repeated-string-match/
5. Problem statement - A string is called a happy prefix if is a non-empty prefix
which is also a suffix (excluding itself).
Given a string s, return the longest happy prefix of s. Return an empty string ""
if no such prefix exists.
Problem link- https://leetcode.com/problems/longest-happy-prefix/
Heap model 1. Problem statement - Design a class to find the kth largest element in a
stream. Note that it is the kth largest element in the sorted order, not the kth
distinct element.
Implement KthLargest class:
KthLargest(int k, int[] nums) Initializes the object with the integer k and the
stream of integers nums.
int add(int val) Appends the integer val to the stream and returns the element
representing the kth largest element in the stream.
Problem link-https://leetcode.com/problems/kth-largest-element-in-a-
stream/
2. Problem statement – You are given an array of integers stones where
stones[i] is the weight of the ith stone.
We are playing a game with the stones. On each turn, we choose the heaviest
two stones and smash them together. Suppose the heaviest two stones have
weights x and y with x <= y. The result of this smash is:
If x == y, both stones are destroyed, and
If x != y, the stone of weight x is destroyed, and the stone of weight y has new
weight y - x.
At the end of the game, there is at most one stone left.
Return the weight of the last remaining stone. If there are no stones left, return
0.
Problem link- https://leetcode.com/problems/last-stone-weight/
3. Problem statement - There are n cities connected by some number of flights.
You are given an array flight where flights[i] = [fromi, toi, pricei] indicates that
there is a flight from city fromi to city toi with cost pricei.

You are also given three integers src, dst, and k, return the cheapest price from
src to dst with at most k stops. If there is no such route, return -1.
Problem link- https://leetcode.com/problems/cheapest-flights-within-k-
stops/
4. Problem statement –In a warehouse, there is a row of barcodes, where the
ith barcode is barcodes[i].
Rearrange the barcodes so that no two adjacent barcodes are equal. You may
return any answer, and it is guaranteed an answer exists.
Problem link- https://leetcode.com/problems/distant-barcodes/
5. Problem statement – You are given an integer array height representing the
heights of buildings, some bricks, and some ladders.
You start your journey from building 0 and move to the next building by possibly
using bricks or ladders.
While moving from building i to building i+1 (0-indexed),
If the current building's height is greater than or equal to the next building's
height, you do not need a ladder or bricks.
If the current building's height is less than the next building's height, you can
either use one ladder or (h[i+1] - h[i]) bricks.
Return the furthest building index (0-indexed) you can reach if you use the given
ladders and bricks optimally.
Problem link-https://leetcode.com/problems/furthest-building-you-can-
reach/

Hashing 1. Problem statement – Given an array nums containing n distinct numbers in


the range [0, n], return the only number in the range that is missing from the
array.
Problem link- https://leetcode.com/problems/missing-number/
2. Problem statement – Given a pattern and a string s, find if s follows the same
pattern.Here follow means a full match, such that there is a bijection between
a letter in pattern and a non-empty word in s.
Input: pattern = "abba", s = "dog cat cat dog"
Output: true
Problem link - https://leetcode.com/problems/word-pattern/
3. Problem statement –
Problem link - https://leetcode.com/problems/longest-substring-without-
repeating-characters/
4. Problem statement – Given a string s, find the length of the longest
Substring without repeating characters.
Input: s = "abcabcbb"
Output: 3
Problem link - https://leetcode.com/problems/longest-duplicate-substring/
5. Problem statement – You are given a string s. You can convert s to a
Palindrome by adding characters in front of it.
Return the shortest palindrome you can find by performing this transformation.
Input: s = "aacecaaa"
Output: "aaacecaaa"
Problem link - https://leetcode.com/problems/shortest-palindrome/
Unit-2 Advanced Data Structures Contact Hours:15
Trees 1. Problem statement- Given the roots of two binary trees p and q, write a
function to check if they are the same or not.Two binary trees are considered
the same if they are structurally identical, and the nodes have the same value.
Problem link- https://leetcode.com/problems/same-tree/
2. Problem statement- Given the root of a binary tree, check whether it is a
mirror of itself (i.e., symmetric around its center).
Problem link- https://leetcode.com/problems/symmetric-tree/
3. Problem statement- Given a binary tree, determine if it is
height-balanced.
Problem link- https://leetcode.com/problems/balanced-binary-tree/
4. Problem statement- Given the root of a binary tree and an integer targetSum,
return true if the tree has a root-to-leaf path such that adding up all the values
along the path equals targetSum.
A leaf is a node with no children.
Problem link- https://leetcode.com/problems/path-sum/
5. Problem statement- Given the root of a complete binary tree, return the
number of the nodes in the tree. According to Wikipedia, every level, except
possibly the last, is completely filled in a complete binary tree, and all nodes in
the last level are as far left as possible. It can have between 1 and 2h nodes
inclusive at the last level h. Design an algorithm that runs in less than O(n) time
complexity.
Problem link- https://leetcode.com/problems/count-complete-tree-nodes/
6. Problem statement- Given a root node reference of a BST and a key, delete
the node with the given key in the BST. Return the root node reference (possibly
updated) of the BST. Basically, the deletion can be divided into two stages:
Search for a node to remove.
If the node is found, delete the node.
Problem link- https://leetcode.com/problems/delete-node-in-a-bst/
7. Problem statement- Given the root of a binary tree, return the length of the
diameter of the tree.
The diameter of a binary tree is the length of the longest path between any two
nodes in a tree. This path may or may not pass through the root.
The length of a path between two nodes is represented by the number of edges
between them.
Problem link- https://leetcode.com/problems/diameter-of-binary-tree/
Graph 1. Problem statement- There is an undirected graph with n nodes, where each
node is numbered between 0 and n - 1. You are given a 2D array graph, where
graph[u] is an array of nodes that node u is adjacent to. More formally, for each
v in graph[u], there is an undirected edge between node u and node v. The
graph has the following properties:
There are no self-edges (graph[u] does not contain u).
There are no parallel edges (graph[u] does not contain duplicate values).
If v is in graph[u], then u is in graph[v] (the graph is undirected).
The graph may not be connected, meaning there may be two nodes u and v
such that there is no path between them.
A graph is bipartite if the nodes can be partitioned into two independent sets A
and B such that every edge in the graph connects a node in set A and a node in
set B.
Return true if and only if it is bipartite.
Problem link- https://leetcode.com/problems/is-graph-bipartite/
2. Problem statement- An n-bit gray code sequence is a sequence of 2n integers
where:Every integer is in the inclusive range [0, 2n - 1],
The first integer is 0,
An integer appears no more than once in the sequence,
The binary representation of every pair of adjacent integers differs by exactly
one bit, and
The binary representation of the first and last integers differs by exactly one bit.
Given an integer n, return any valid n-bit gray code sequence.
Problem link- https://leetcode.com/problems/gray-code/
3. Problem statement- There are n people that are split into some unknown
number of groups. Each person is labeled with a unique ID from 0 to n - 1.
You are given an integer array groupSizes, where groupSizes[i] is the size of the
group that person i is in. For example, if groupSizes[1] = 3, then person 1 must
be in a group of size 3.
Return a list of groups such that each person i is in a group of size groupSizes[i].
Each person should appear in exactly one group, and every person must be in a
group. If there are multiple answers, return any of them. It is guaranteed that
there will be at least one valid solution for the given input.
Problem link- https://leetcode.com/problems/group-the-people-given-the-
group-size-they-belong-to/
4. Problem statement- A city's skyline is the outer contour of the silhouette
formed by all the buildings in that city when viewed from a distance. Given the
locations and heights of all the buildings, return the skyline formed by these
buildings collectively.The geometric information of each building is given in the
array buildings where buildings[i] = [lefti, righti, heighti]:
lefti is the x coordinate of the left edge of the ith building.
righti is the x coordinate of the right edge of the ith building.
heighti is the height of the ith building.
You may assume all buildings are perfect rectangles grounded on an absolutely
flat surface at height 0.
The skyline should be represented as a list of "key points" sorted by their x-
coordinate in the form [[x1,y1],[x2,y2],...]. Each key point is the left endpoint of
some horizontal segment in the skyline except the last point in the list, which
always has a y-coordinate 0 and is used to mark the skyline's termination where
the rightmost building ends. Any ground between the leftmost and rightmost
buildings should be part of the skyline's contour.
Problem link- https://leetcode.com/problems/the-skyline-problem/
5. Problem statement- You are given two strings s and t.
String t is generated by random shuffling string s and then add one more letter
at a random position.
Return the letter that was added to t.
Problem link- https://leetcode.com/problems/find-the-difference/
6. Problem statement- You are given an integer array nums. Two players are
playing a game with this array: player 1 and player 2.
Player 1 and player 2 take turns, with player 1 starting first. Both players start
the game with a score of 0. At each turn, the player takes one of the numbers
from either end of the array (i.e., nums[0] or nums[nums.length - 1]) which
reduces the size of the array by 1. The player adds the chosen number to their
score. The game ends when there are no more elements in the array.
Return true if Player 1 can win the game. If the scores of both players are equal,
then player 1 is still the winner, and you should also return true. You may
assume that both players are playing optimally.
Problem link- https://leetcode.com/problems/predict-the-winner/
Divide and 1. Problem statement- The count-and-say sequence is a sequence of digit
conquer strings defined by the recursive formula:
countAndSay(1) = "1"
countAndSay(n) is the way you would "say" the digit string from
countAndSay(n-1), which is then converted into a different digit string.
To determine how you "say" a digit string, split it into the minimal number of
substrings such that each substring contains exactly one unique digit. Then for
each substring, say the number of digits, then say the digit. Finally, concatenate
every said digit.
Problem link- https://leetcode.com/problems/count-and-say/
3. Problem statement- We have two special characters:
The first character can be represented by one bit 0.
The second character can be represented by two bits (10 or 11).
Given a binary array bit that ends with 0, return true if the last character must
be a one-bit character.
Problem link- https://leetcode.com/problems/1-bit-and-2-bit-characters/
4. Problem statement- You're given strings jewels representing the types of
stones that are jewels, and stones representing the stones you have. Each
character in stones is a type of stone you have. You want to know how many of
the stones you have are also jewels.
Letters are case sensitive, so "a" is considered a different type of stone from
"A".
Problem link- https://leetcode.com/problems/jewels-and-stones/
5. Problem statement- You are given an n x n integer matrix board where the
cells are labeled from 1 to n2 in a Boustrophedon style starting from the bottom
left of the board (i.e. board[n - 1][0]) and alternating direction each row.
You start on square 1 of the board. In each move, starting from square curr, do
the following:
Choose a destination square next with a label in the range [curr + 1, min(curr +
6, n2)].
This choice simulates the result of a standard 6-sided die roll: i.e., there are
always at most 6 destinations, regardless of the size of the board.
If next has a snake or ladder, you must move to the destination of that snake or
ladder. Otherwise, you move to next.
The game ends when you reach the square n2.
A board square on row r and column c has a snake or ladder if board[r][c] != -1.
The destination of that snake or ladder is board[r][c]. Squares 1 and n2 do not
have a snake or ladder.
Note that you only take a snake or ladder at most once per move. If the
destination to a snake or ladder is the start of another snake or ladder, you do
not follow the subsequent snake or ladder.
Problem link- https://leetcode.com/problems/snakes-and-ladders/
6. Problem statement- You are given two jugs with capacities jug1Capacity and
jug2Capacity liters. There is an infinite amount of water supply available.
Determine whether it is possible to measure exactly targetCapacity liters using
these two jugs.
If targetCapacity liters of water are measurable, you must have targetCapacity
liters of water contained within one or both buckets by the end.
Operations allowed:
Fill any of the jugs with water.
Empty any of the jugs.
Pour water from one jug into another till the other jug is completely full, or the
first jug itself is empty.
Problem link- https://leetcode.com/problems/water-and-jug-problem/
7. Problem statement- You are given a 0-indexed string s that you must perform
k replacement operations on. The replacement operations are given as three 0-
indexed parallel arrays, indices, sources, and targets, all of length k.
To complete the ith replacement operation:
Check if the substring sources[i] occurs at index indices[i] in the original string
s.If it does not occur, do nothing.
Otherwise, if it does occur, replace that substring with targets[i].
Problem link- https://leetcode.com/problems/find-and-replace-in-string/
UNIT-3 Advanced Data Structures Contact Hours:15
Greedy 1. Problem statement- There are n children standing in a line. Each child is
assigned a rating value given in the integer array ratings.
You are giving candies to these children subjected to the following
requirements:
Each child must have at least one candy.
Children with a higher rating get more candies than their neighbors.
Return the minimum number of candies you need to have to distribute the
candies to the children.
Problem link- https://leetcode.com/problems/candy/
2. Problem statement-
Problem link- https://leetcode.com/problems/best-time-to-buy-and-sell-
stock-ii/
3. Problem statement- Given a string s, remove duplicate letters so that every
letter appears once and only once. You must make sure your result is the
smallest in lexicographical order among all possible results.
Input: s = "bcabc"
Output: "abc"
Problem link- https://leetcode.com/problems/remove-duplicate-letters/
4. Problem statement- You have a long flowerbed in which some of the plots
are planted, and some are not. However, flowers cannot be planted in adjacent
plots.
Given an integer array flowerbed containing 0's and 1's, where 0 means empty
and 1 means not empty, and an integer n, return true if n new flowers can be
planted in the flowerbed without violating the no-adjacent-flowers rule and
false otherwise.
Problem link- https://leetcode.com/problems/can-place-flowers/
5. Problem statement- Assume you are an awesome parent and want to give
your children some cookies. But you should give each child at most one cookie.
Each child i has a greed factor g[i], which is the minimum size of a cookie that
the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we
can assign the cookie j to the child i, and the child i will be content. Your goal is
to maximize the number of your content children and output the maximum
number.
Problem link- https://leetcode.com/problems/assign-cookies/
6. Problem statement- You are given an array arr which consists of only zeros
and ones, divide the array into three non-empty parts such that all of these
parts represent the same binary value.If it is possible, return any [i, j] with i + 1
< j, such that: arr[0], arr[1], ..., arr[i] is the first part,
arr[i + 1], arr[i + 2], ..., arr[j - 1] is the second part, and
arr[j], arr[j + 1], ..., arr[arr.length - 1] is the third part.
All three parts have equal binary values.
If it is not possible, return [-1, -1].
Note that the entire part is used when considering what binary value it
represents. For example, [1,1,0] represents 6 in decimal, not 3. Also, leading
zeros are allowed, so [0,1,1] and [1,1] represent the same value.
Problem link- https://leetcode.com/problems/three-equal-parts/
Backtracking 1. Problem statement- A binary watch has 4 LEDs on the top to represent the
hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each
LED represents a zero or one, with the least significant bit on the right.
For example, the below binary watch reads "4:51". Given an integer turnedOn
which represents the number of LEDs that are currently on (ignoring the PM),
return all possible times the watch could represent. You may return the answer
in any order. The hour must not contain a leading zero.
For example, "01:00" is not valid. It should be "1:00".
The minute must consist of two digits and may contain a leading zero.
For example, "10:2" is not valid. It should be "10:02".
Problem link- https://leetcode.com/problems/binary-watch/
2. Problem statement- We are given n different types of stickers. Each sticker
has a lowercase English word on it.
You would like to spell out the given string target by cutting individual letters
from your collection of stickers and rearranging them. You can use each sticker
more than once if you want, and you have infinite quantities of each sticker.
Return the minimum number of stickers that you need to spell out target. If the
task is impossible, return -1.

Note: In all test cases, all words were chosen randomly from the 1000 most
common US English words, and target was chosen as a concatenation of two
random words.
Problem link- https://leetcode.com/problems/stickers-to-spell-word/
3. Problem statement- Given a directed acyclic graph (DAG) of n nodes labeled
from 0 to n - 1, find all possible paths from node 0 to node n - 1 and return them
in any order.
The graph is given as follows: graph[i] is a list of all nodes you can visit from
node i (i.e., there is a directed edge from node i to node graph[i][j]).
Problem link- https://leetcode.com/problems/all-paths-from-source-to-
target/
4. Problem statement- A transformation sequence from word beginWord to
word endWord using a dictionary wordList is a sequence of words beginWord -
> s1 -> s2 -> ... -> sk such that:
Every adjacent pair of words differs by a single letter.
Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be
in wordList.
sk == endWord
Given two words, beginWord and endWord, and a dictionary wordList, return
all the shortest transformation sequences from beginWord to endWord, or an
empty list if no such sequence exists. Each sequence should be returned as a list
of the words [beginWord, s1, s2, ..., sk].
Problem link- https://leetcode.com/problems/word-ladder-ii/
5. Problem statement- Given an integer array nums of unique elements, return
all possible subsets (the power set).
The solution set must not contain duplicate subsets. Return the solution in any
order.
Input: nums = [1,2,3]
Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Problem link- https://leetcode.com/problems/subsets/
6. Problem statement- Given two integers n and k, return all possible
combinations of k numbers chosen from the range [1, n].
You may return the answer in any order.
Input: n = 4, k = 2
Output: [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
Problem link- https://leetcode.com/problems/combinations/
Dynamic 1. Problem statement- You are given an array prices where prices[i] is the price
Programming of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and
choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction. If you cannot
achieve any profit, return 0.
Problem link- https://leetcode.com/problems/best-time-to-buy-and-sell-
stock/
2. Problem statement- A message containing letters from A-Z can be encoded
into numbers using the following mapping:
'A' -> "1"
'B' -> "2"
...
'Z' -> "26"
To decode an encoded message, all the digits must be grouped then mapped
back into letters using the reverse of the mapping above (there may be multiple
ways). For example, "11106" can be mapped into:
"AAJF" with the grouping (1 1 10 6)
"KJF" with the grouping (11 10 6)
Note that the grouping (1 11 06) is invalid because "06" cannot be mapped into
'F' since "6" is different from "06".
Given a string s containing only digits, return the number of ways to decode it.
The test cases are generated so that the answer fits in a 32-bit integer.
Problem link- https://leetcode.com/problems/decode-ways/
3. Problem statement- We can scramble a string s to get a string t using the
following algorithm:
If the length of the string is 1, stop.
If the length of the string is > 1, do the following:
Split the string into two non-empty substrings at a random index, i.e., if the
string is s, divide it to x and y where s = x + y.
Randomly decide to swap the two substrings or to keep them in the same order.
i.e., after this step, s may become s = x + y or s = y + x.
Apply step 1 recursively on each of the two substrings x and y.
Given two strings s1 and s2 of the same length, return true if s2 is a scrambled
string of s1, otherwise, return false.
Problem link- https://leetcode.com/problems/scramble-string/
4. Problem statement- You are climbing a staircase. It takes n steps to reach the
top. Each time you can either climb 1 or 2 steps. In how many distinct ways can
you climb to the top?
Problem link- https://leetcode.com/problems/climbing-stairs/
5. Problem statement- Given an integer array nums, find the subarray
with the largest sum, and return its sum.
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Problem link- https://leetcode.com/problems/maximum-subarray/
6. Problem statement- Given a string s, return the longest Palindromic substring
in s.
Input: s = "babad"
Output: "bab"
Problem link- https://leetcode.com/problems/longest-palindromic-
substring/
7. Problem statement- You are a professional robber planning to rob houses
along a street. Each house has a certain amount of money stashed. All houses
at this place are arranged in a circle. That means the first house is the neighbor
of the last one. Meanwhile, adjacent houses have a security system connected,
and it will automatically contact the police if two adjacent houses were broken
into on the same night.
Given an integer array nums representing the amount of money of each house,
return the maximum amount of money you can rob tonight without alerting the
police.
Problem link- https://leetcode.com/problems/house-robber-ii/

e. References

1. “Introduction to Algorithms” by Thomas H. Cormen,


Charles E. Leiserson,Ronald L.Rivest, and Clifford
Stein.
2. Algorithms Unlocked” by Thomas H. Cormen
3. “Data Structures and Algorithms Made Easy: Data
Structures and AlgorithmicPuzzles”by Narasimha
Karumanchi.
4. “Grokking Algorithms: An illustrated guide for
programmers and othercurious people”by
Aditya Bhargava

f. Assessment Pattern - Internal and External


The performance of students is evaluated as follows:

Theory

Components Continuous Internal Semester End Examination


Assessment (CAE) (SEE)
Marks 60 40

Total Marks 100

g. Internal Evaluation Component

Sr. Type of Weightage of actual Frequency Final Weightage in Remarks


No. Assessment conduct of Task Internal
Assessment
1 Conduct 10 Marks per 1 per 60 Marks per course
Practical practical
2 Report 10 Marks per 1 per
Practical practical
3 Viva- Voce 20 Marks per Course 1 per
Course

h. Relationship between the Course Outcomes (COs) and Program Outcomes (POs)

Mapping Between COs and POs


SN Course Outcome (CO) Mapped Programme Outcome (PO)
1 CO1 PO1, PO6, PO10, PSO1
2 CO2 PO1, PO2, PO4, PO5, PO10
3 CO3 PO2, PO4, PSO1
4 CO4 PO2, PO4, PO5, PO9, PO12
5 CO5 PO3,PO8, PO11, PO12

g. CO-PO Mapping

Course
PO1 PO PO PSO PS
Outco PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9
0 11 12 1 O2
me

CO1 3 - - - - 2 - - - 1 - - 2 -

CO2 3 3 - 2 3 - - - - 2 - - - -

CO3 - 3 - 3 - - - - - - - - 2 -

CO4 - 3 - 2 3 - - - 2 - - 2 - -

CO5 - - 2 - - - - 1 - - 3 3 - -

AVG 3 3 2 2.3 3 2 - 1 2 1.5 3 2.5 2 -

PSO1
PSO2

PO1 PO1 PO1


PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 0 1 2
Course Course Name 1 2 3 4 5 6 7 8 9 1 1 12
Code 0 1
21CSP- Advance 3 3 2 2.3 3 2 - 1 2 1.5 3 2.5 -
351/21ITP- Programming 2
351 Lab – II

You might also like