AP LAB-II SYLLABUS final.docx
AP LAB-II SYLLABUS final.docx
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 Analyze the appropriate approaches for specific problems and achieve all test cases.
CO4 Evaluate various solutions based on their efficiency, correctness, and resource utilization.
CO5 Design and implement algorithms or systems, ensuring their optimal functionality,
scalability, and maintainability.
d. Syllabus
Linked 1. Problem statement - You are given the heads of two sorted CO1,
List, linked lists list1 and list2.Merge the two lists into one sorted CO3,
Operating list. The list should be made by splicing together the nodes of CO2
System the first two lists. Return the head of the merged linked list.
based Problem link-
question https://leetcode.com/problems/merge-two-sorted-lists/
When a key is first inserted into the cache, its use counter is set to
1 (due to the put operation). The use counter for a key in the
cache is incremented; either a get or put operation is called on it.
The functions get and put must each run in O(1) average time
complexity.
Problem link - https://leetcode.com/problems/lfu-cache/
10. 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/
You are also given a positive integer space, which represents the
minimum number of days that must pass after the completion of a
task before another task of the same type can be performed.
Each day, until all tasks have been completed, you must either:
Tree 1. Problem statement- Given the roots of two binary trees p CO3
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/
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 CO3,
Programmi prices[i] is the price of a given stock on the ith day. CO4,
ng You want to maximize your profit by choosing a single day to buy CO5
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
Theory
i. CO-PO Mapping
Course
Outcome PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO1 3 3 3 3 3 - - - 2 1 - 2 2 -
CO2 3 3 2 2 3 - - - 2 - - - 2 3
CO3 3 3 1 3 2 - - - 2 - - - 2 -
CO4 - 3 - 2 3 - - - - 2 2 - 1 -
CO5 - 2 3 2 3 - - 2 3 3 2 1 - 2
Average 3 2.8 2.25 2.4 2.8 - - 2 2.25 2 2 1.5 1.75 2.5
Course Course Name PO1 PO3 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
Code
22CSP- Advance
351/22ITP- Programming
351 Lab – II
3 2.8 2.25 2.4 2.8 - - 2 2.25 2 2 1.5 1.75 2.5