0% found this document useful (0 votes)
28 views15 pages

AP LAB-1 Syllabus

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 15

Syllabus

Program Code- TITLE OF THE COURSE L T P C CH


CS201/ BI519 /
CS202/CS703/CS704 Advanced Programming Lab-1 0 0 2 1 2
/IT201/IT202
Subject Code-
22CSP-314/ITT-314
PRE-
REQUISITE Basics of C, C++, Data Structure
CO- REQUISITE
Data Structure
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 Arrays, 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

Experiment 1 1. Array Reversal: -


Arrays Problem Statement: - Given an array, of size, reverse it. Example: If array, arr= {1,2,3,4,5},
after reversing it, the array should be, arr= {5,4,3,2,1}.
Problem Link:
https://www.hackerrank.com/challenges/reverse-
array-c/problem?isFullScreen=true
2. Sum of array: -
Problem Statement: Given an array of integers, find the sum of its elements.
For example, if the array, so return.
Function Description
Complete the simpleArraySum function in the editor below. It must return the sum of the array
elements as an integer.
simpleArraySum has the following parameter(s):
 ar: an array of integers
Problem Link: https://www.hackerrank.com/challenges/simple-
array-sum/problem
3. Compare the triplets
Problem Statement: Alice and Bob each created one problem for HackerRank. A reviewer
rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem
clarity, originality, and difficulty.
The rating for Alice's challenge is the triplet a = (a[0], a[1], a[2]), and the rating for Bob's
challenge is the triplet b = (b[0], b[1], b[2]).
The task is to find their comparison points by comparing a[0] with b[0], a[1] with b[1],
and a[2] with b[2].
 If a[i] > b[i], then Alice is awarded 1 point.
 If a[i] < b[i], then Bob is awarded 1 point.
 If a[i] = b[i], then neither person receives a point.
 Comparison points is the total points a person earned.
Given a and b, determine their respective comparison points.
Problem Link:
https://www.hackerrank.com/challenges/compare-the-
triplets/problem?isFullScreen=true
4. Display an element of an array
Problem Statement: Given a list of countries, each on a new line, your task is to read them into
an array and then display the element indexed at 0. Note that indexing starts from 3.

Problem Link: https://www.hackerrank.com/challenges/bash-tutorials-display-the-third-


element-of-an-array/problem

5. Diagonal Difference
Problem Statement: Given a square matrix, calculate the absolute difference between the sums
of its diagonals.
For example, the square matrix is shown below:
123
456
989
The left-to-right diagonal =. The right to left diagonal =. Their absolute difference is.
Function description
Complete the function in the editor below.
Diagonal Difference takes the following parameter:
 int arr[n][m]: an array of integers
Return
 int: the absolute diagonal difference
Problem Link:
https://www.hackerrank.com/challenges/diagonal-difference/problem
Experiment 2 1. Equal Stack: -
Stacks & Queue Problem Statement: 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.
Example
H1= [1,2,1,1,]
H2= [1,1,2]
H3= [1,1]
There are and cylinders in the three stacks, with their heights in the three arrays. Remove the
top 2 cylinders from (heights = [1, 2]) and from (heights = [1, 1]) so that the three stacks all are
2 units tall. Return as the answer.
Note: An empty stack is still a stack.
Problem Link:
https://www.hackerrank.com/challenges/equal-stacks/problem
2. Game of two stack: -
Problem Statement: 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, and for games, find the maximum possible score Nick can achieve.
Example
A= [1,2,3,4,5]
B= [6,7,8,9]
The maximum number of values Nick can remove is. There are two sets of choices with this
result.
1. Remove from with a sum of.
2. Remove from and from with a sum of.
Problem Link:
https://www.hackerrank.com/challenges/game-of-two-
stacks/problem
3. Balanced Brackets: -
Problem Statement: A bracket is considered to be any one of the following
characters: (, ), {, }, [, or ].
Two brackets are considered to be a matched pair if the an opening bracket (i.e., (, [, or {)
occurs to the left of a closing bracket (i.e., ), ], or }) of the exact same type. There are three
types of matched pairs of brackets: [], {}, and ().
A matching pair of brackets is not balanced if the set of brackets it encloses are not matched.
For example, {[(])} is not balanced because the contents in between { and } are not balanced.
The pair of square brackets encloses a single, unbalanced opening bracket, (, and the pair of
parentheses encloses a single, unbalanced closing square bracket, ].
By this logic, we say a sequence of brackets is balanced if the following conditions are met:
 It contains no unmatched brackets.
 The subset of brackets enclosed within the confines of a matched pair of brackets is
also a matched pair of brackets.
Given strings of brackets, determine whether each sequence of brackets is balanced. If a string
is balanced, return YES. Otherwise, return NO.
Function Description
Complete the function isBalanced in the editor below.
isBalanced has the following parameter(s):
 string s: a string of brackets
Returns
 string: either YES or NO

Problem Link:
https://www.hackerrank.com/challenges/balanced-
brackets/problem

4. Castle on the grid

Problem Statement: You are given a square grid with some cells open (.) and some blocked
(X). Your playing piece can move along any row or column until it reaches the edge of the
grid or a blocked cell. Given a grid, a start and a goal, determine the minmum number of
moves to get to the goal.

Problem Link:
https://www.hackerrank.com/domains/data-
structures?filters%5Bsubdomains%5D%5B%5D=queues

5. Queues: A Tale of Two Stacks

Problem Statement: - 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 the longest) is always
the first one to be removed.

Problem Link:
https://www.hackerrank.com/challenges/ctci-queue-
using-two-stacks/problem
Experiment 3 1. Compare Two Linked List: -
Linked List Problem Statement: 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.
Example

The two lists have equal data attributes for the first 3 nodes. Llist2 is longer, though, so the
lists are not equal. Return 0.
Problem Link:
https://www.hackerrank.com/challenges/compare-two-
linked-lists/problem
2. Sorted Doubly Linked List: -
Problem Statement: Given a reference to the head of a doubly-linked list and an integer, ,
create a new DoublyLinkedListNode object having data value and insert it at the proper location
to maintain the sort.
Example
Head refers to the list
data=3
Return a reference to the new list:
Problem Link:
https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-
linked-list/problem
3. Doubly Linked List: -
Problem Statement: Given the pointer to the head node of a doubly linked list, reverse the
order of the nodes in place. That is, change the next and prev pointers of the nodes so that the
direction of the list is reversed. Return a reference to the head node of the reversed list.
Note: The head node might be NULL to indicate that the list is empty.
Problem Link:
https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list/problem
4. Joined Linked List: -
Problem Statement: Given pointers to the head nodes of 2 linked lists that merge together at
some point, find the node where the two lists merge. The merge point is where both lists point
to the same node, i.e. they reference the same memory location. It is guaranteed that the two
head nodes will be different, and neither will be NULL. If the lists share a common node, return
that node's data value.
Note: After the merge point, both lists will share the same node pointers.
Problem Link:
https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-
linked-lists/problem
5. Detect cycle: -
Problem Statement: 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.
Problem Link:
https://www.hackerrank.com/challenges/detect-whether-a-linked-list-
contains-a-cycle/problem
Experiment 4 1. Fraudulent-Activity: -
Searching and
Sorting Problem Statement: HackerLand National Bank has a simple policy for warning clients about
possible fraudulent account activity. If the amount spent by a client on a particular day is greater
than or equal to 2* the client's median spending for a trailing number of days, they send the client
a notification about potential fraud. The bank doesn't send the client any notifications until they
have at least that trailing number of prior days' transaction data.
Given the number of trailing days d and a client's total daily expenditures for a period of n days,
determine the number of times the client will receive a notification over all n days.
Problem Link: https://www.hackerrank.com/challenges/fraudulent
-activity-notifications/problem?isFullScreen=true

2. Missing Number: -
Problem Statement: Given two arrays of integers, find which elements in the second array are
missing from the first array.

Example

The brr array is the original list. The numbers missing are [4,6].
Problem Link:
https://www.hackerrank.com/challenges/missing-numbers/problem
3. Minimum Loss: -
Problem Statement: Lauren has a chart of distinct projected prices for a house over the
next several years. She must buy the house in one year and sell it in another, and she must
do so at a loss. She wants to minimize her financial loss.
Problem Link: https://www.hackerrank.com/challenges/minimum-loss/problem
4. Closet Number: -
Problem Statement: Sorting is useful as the first step in many different tasks.
The most common task is to make finding things easier, but there are other uses
as well. In this case, it will make it easier to determine which pair or pairs of
elements have the smallest absolute difference between them.
Problem Link:
https://www.hackerrank.com/challenges/closest-numbers/problem

5. Quick Sort: -
Problem Statement: The previous challenges covered Insertion Sort, which is a simple and
intuitive sorting algorithm with a running time of O(N2) . In these next few challenges, we're
covering a divide-and-conquer algorithm called Quicksort (also known as Partition Sort). This
challenge is a modified version of the algorithm that only addresses partitioning. It is implemented
as follows:
Step1:Divide
Choose some pivot element, p, and partition your unsorted array, arr, into three smaller
arrays: left, Right, and Equal , where each element in Left<p , each element in Right >p , and
each element in equal=p.
Problem Link:
https://www.hackerrank.com/challenges/quicksort1/problem

Unit- Contact Hours:15


2
1. Pangram
Experiment-5
Problem Statement: - A pangram is a string that contains every letter of the alphabet. Given a
String sentence determine whether it is a pangram in the English alphabet. Ignore case. Return
either pangram or not pangram as appropriate.
Problem Link:
https://www.hackerrank.com/challenges/pangrams/problem?i sFu
llSc reen=true
2. Camel Case
Problem Statement: - There is a sequence of words in CamelCase as a string of letters,s,
having the following properties:
 It is a concatenation of one or more words consisting of English letters.
 All letters in the first word are lowercase.
 For each of the subsequent words, the first letter is uppercase and rest of the letters
are lowercase.
Given, determine the number of words in s.
Problem Link:
https://www.hackerrank.com/challenges/camelcase/problem?i sFu llScreen=true
3. Strong Password
Problem Statement: - Louise joined a social networking site to stay in touch with her friends.
The signup page required her to input a name and a password. However, the password must
be strong. The website considers a password to be strong if it satisfies the following criteria:
 Its length is at least.
 It contains at least one digit.
 It contains at least one lowercase English character.
 It contains at least one uppercase English character.
 It contains at least one special character. The special characters are: !@#$%^&*()-+
She typed a random string of length in the password field but wasn't sure if it was strong. Given
the string she typed, can you find the minimum number of characters she must add to make her
password strong?
Note: Here's the set of types of characters in a form you can paste in your solution:
numbers = "0123456789"
lower_case = "abcdefghijklmnopqrstuvwxyz"
upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
special_characters = "!@#$%^&*()-+"
.Problem Link:
https://www.hackerrank.com/challenges/strong-password/problem
3. Find a string

Problem Statement: - In this challenge, the user enters a string and a substring. You have to
print the number of times that the substring occurs in the given string. String traversal will take
place from left to right, not from right to left.

Problem Link:
https://www.hackerrank.com/challenges/find-a-string/problem
4. String Reductions
Problem Statement: Given a string, , consisting of lowercase
English characters ( ), remove all of the characters that occurred previously in the
string. Formally, remove all characters,siA , for:

Problem Link:
https://www.hackerrank.com/challenges/string-reductions/problem

1. Tree top view


Experiment-6
Problem Statement: Given a pointer to the root of a binary tree, print the top view of the
Trees binary tree. The tree as seen from the top the nodes, is called the top view of the tree.
Problem Link:
https://www.hackerrank.com/challenges/tree-top-view/problem
2. Binary Search tree insertion
Problem Statement: You are given a pointer to the root of a binary search tree and values to be
inserted into the tree. Insert the values into their appropriate position in the binary search tree
and return the root of the updated binary tree. You just have to complete the function.
Problem Link:
https://www.hackerrank.com/challenges/binary-search-tree-
insertion/problem

3. Inorder Traversal
Problem Statement: In this challenge, you are required to implement inorder traversal of a
tree.Complete the inorder function in your editor below, which has 1 parameter: a pointer to the
root of a binary tree. It must print the values in the tree's inorder traversal as a single line of
space-separated values.
Problem Link:
https://www.hackerrank.com/challenges/tree-inorder-traversal/problem
4. Balanced Forest
Problem Statement: - Greg has a tree of nodes containing integer data. He wants to insert a node
with some non-zero integer value somewhere into the tree. His goal is to be able to cut two edges
and have the values of each of the three new trees sum to the same amount. This is called
a balanced forest. Being frugal, the data value he inserts should be minimal. Determine the
minimal amount that a new node can have to allow creation of a balanced forest. If it's not possible
to create a balanced forest, return -1.
Problem Link:
https://www.hackerrank.com/challenges/balanced-forest/problem
5. Even Tree: -
Problem Statement: You are given a tree (a simple connected graph with no cycles).
Find the maximum number of edges you can remove from the tree to get a forest such that each
connected component of the forest contains an even number of nodes.
Problem Link:
https://www.hackerrank.com/challenges/even-tree/problem

1. Bfs short reach: -


Experiment-7
Problem Statement: Consider an undirected graph where each edge weighs 6 units. Each of the
Graph nodes is labelled consecutively from 1 to n.
You will be given a number of queries. For each query, you will be given a list of edges describing
an undirected graph. After you create a representation of the graph, you must determine and report
the shortest distance to each of the other nodes from a given starting position using the breadth-
first search algorithm (BFS). Return an array of distances from the start node in node number
order. If a node is unreachable, return -1 for that node.
Problem Link:
https://www.hackerrank.com/challenges/bfsshortreach/problem
2. Quickest Way Up: -
Problem Statement: Markov takes out his Snakes and Ladders game, stares at the board
and wonders: "If I can always roll the die to whatever number I want, what would be the
least number of rolls to reach the destination?"
Rules The game is played with a cubic die of 6 faces numbered 1 to 6.
1. Starting from square 1 , land on square 100 with the exact roll of the die. If
moving the number rolled would place the player beyond square 100 , no move
is made.
2. If a player lands at the base of a ladder, the player must climb the ladder.
Ladders go up only.
3. If a player lands at the mouth of a snake, the player must go down the snake
and come out through the tail. Snakes go down only.
Problem Link:
https://www.hackerrank.com/challenges/the-quickest-way-
up/problem
3. Costly Graphs
Problem Statement: Let's define the cost of a simple undirected graph as the sum of the
costs of its nodes. The cost of a node is defined as DK, where D is its degree.
You are given N and K. You need to find the sum of the costs of all possible simple
undirected graphs with N nodes. As this number may be very large, output the sum modulo
1005060097.

Problem Link:
https://www.hackerrank.com/challenges/costly-graphs/problem

4. Three-Month- Preparation-Kit-Journey-To-The- Moon


Problem Statement: The member states of the UN are planning to send 2 people
to the moon. They want them to be from different countries. You will be given a
list of pairs of astronaut ID's. Each pair is made of astronauts from the same
country. Determine how many pairs of astronauts from different countries they
can choose from.
Problem Link:
https://www.hackerrank.com/challenges/three-month-preparation-kit-journey-to-the-
moon/problem
5. Frog in Maze
Problem Statement: Alef the Frog is in an n*m,two-dimensional maze represented as a table.
The maze has the following characteristics:
 Each cell can be free or can contain an obstacle, an exit, or a mine.
 Any two cells in the table considered adjacent if they share a side.
 The maze is surrounded by a solid wall made of obstacles.
 Some pairs of free cells are connected by a bidirectional tunnel.
When Alef is in any cell, he can randomly and with equal probability choose to move into one
of the adjacent cells that don't contain an obstacle in it. If this cell contains a mine, the mine
explodes and Alef dies. If this cell contains an exit, then Alef escapes the maze.
When Alef lands on a cell with an entrance to a tunnel, he is immediately transported through
the tunnel and is thrown into the cell at the other end of the tunnel. Thereafter, he won't fall
again, and will now randomly move to one of the adjacent cells again. (He could possibly fall in
the same tunnel later.)
It's possible for Alef to get stuck in the maze in the case when the cell in which he was thrown
into from a tunnel is surrounded by obstacles on all sides.
Your task is to write a program which calculates and prints a probability that Alef escapes the
maze.
Problem Link:
https://www.hackerrank.com/challenges/frog-in-
maze/problem?isFullScreen=true

Contact Hours-15
UNIT-3
1. Marcs Cakewalk
Experiment-8 Problem Statement: - Marc loves cupcakes, but he
also likes to stay fit. Each cupcake has a calorie count,
Greedy and Branch
and Marc can walk a distance to expend those
and Bound
calories. If Marc has eaten j cupcakes so far, after
eating a cupcake with c calories he must walk at
least 2j *cmiles to maintain his weight.
Problem link :-
https://www.hackerrank.com/challenges/marcs-
cakewalk/problem
2. Candies
Problem Statement: - Alice is a kindergarten teacher. She wants to give some candies to the
children in her class. All the children sit in a line and each of them has a rating score according
to his or her performance in the class. Alice wants to give at least 1 candy to each child. If two
children sit next to each other, then the one with the higher rating must get more candies. Alice
wants to minimize the total number of candies she must buy.
Problem link :-
https://www.hackerrank.com/challenges/candies/problem

3. Truck Tour: -
Problem Statement: Suppose there is a circle. There are N petrol pumps on that circle. Petrol
pumps are numbered 0 to (N-1) (both inclusive). You have two pieces of information
corresponding to each of the petrol pump: (1) the amount of petrol that particular petrol pump
will give, and (2) the distance from that petrol pump to the next petrol pump.
Initially, you have a tank of infinite capacity carrying no petrol. You can start the tour at any of
the petrol pumps. Calculate the first point from where the truck will be able to complete the
circle. Consider that the truck will stop at each of the petrol pumps. The truck will move one
kilometre for each litre of the petrol.
Problem Link:
https://www.hackerrank.com/challenges/truck-tour/problem

4. Priyanka and Toys


Problem Statement: Priyanka works for an international toy company that
ships by container. Her task is to the determine the lowest cost way to
combine her orders for shipping. She has a list of item weights. The shipping
company has a requirement that all items loaded in a container must weigh
less than or equal to 4 units plus the weight of the minimum weight item. All
items meeting that requirement will be shipped in one container.
What is the smallest number of containers that can be contracted to ship the items based othe
given list of weights?
Problem Link:
https://www.hackerrank.com/challenges/priyanka-and-toys/problem?isFullScreen=true

5. Luck Balance
Problem Statement: -Lena is preparing for an important coding competition that is preceded by
a number of sequential preliminary contests. Initially, her luck balance is 0. She believes in
"saving luck", and wants to check her theory.
Problem Link:
https://www.hackerrank.com/challenges/luck-balance/problem?isFullScreen=true
Experiment-9 1. Sudoku: -
Problem Statement: Given a partially filled 9 x 9 sudoku board, you need to output a solution
Back-tracking/ to it.
Dynamic Input-The first line contains N which is the number of Sudoku puzzles. N Sudoku puzzles follow.
Programmingg Each one contains 9 lines with each line containing 9 space separated integers. A 0 indicates an
unfilled square, and an integer between 1 and 9 denotes a filled square with that value.
Output-Output to STDOUT the completely filled Sudoku board for each Sudoku. If there are
multiple solutions, you can output any one.

Problem Link: - https://www.hackerrank.com/challenges/sudoku/problem

2. Crossword Puzzle: -
Problem Statement: - A 10*10 Crossword grid is provided to you, along with a set
of words (or names of places) which need to be filled into the grid. Cells are marked
either + or -. Cells marked with a - are to be filled with the word list.
Problem link: -
https://www.hackerrank.com/challenges/crossword-puzzle/problem
3. Fibonacci Numbers: -
Problem Statement: - The Fibonacci sequence appears in nature all around us, in the
arrangement of seeds in a sunflower and the spiral of a nautilus for example.
The Fibonacci sequence begins with Fibonacci (0)=0 and Fibonacci(1)=1 and as its first and
second terms. After these first two elements, each subsequent element is equal to the sum of the
previous two elements.
Problem link: -
https://www.hackerrank.com/challenges/ctci-fibonacci-numbers/problem

4. Queens on Board: -
Problem Statement: You have an N * M chessboard on which some squares are blocked
out. In how many ways can you place one or more queens on the board, such that, no two
queens attack each other? Two queens attack each other, if one can reach the other by
moving horizontally, vertically, or diagonally without passing over any blocked square. At
most one queen can be placed on a square. A queen cannot be placed on a blocked square.

Problem Link: - https://www.hackerrank.com/challenges/queens-on-board/problem

1. Construct the array: -


Problem Statement: Your goal is to find the number of ways to construct an array such that
consecutive positions contain different values.
Specifically, we want to construct an array with N elements such that each element
between 1 and K , inclusive. We also want the first and last elements of the array to be 1 and x .
Given n ,K and x, find the number of ways to construct such an array. Since the answer may be
large, only find it modulo 109+7.

Problem Link:
https://www.hackerrank.com/challenges/construct-the-
array/problem

Sam and Sub string


Problem Statement: - Samantha and Sam are playing a numbers game. Given a number as a
string, no leading zeros, determine the sum of all integer values of substrings of the string.
Given an integer as a string, sum all of its substrings cast as integers. As the number may
become large, return the value modulo 109+7.

Problem Link:
https://www.hackerrank.com/challenges/sam-and-substrings/problem

3. Equal
Problem Statement: Christy is interning at HackerRank. One day she has to distribute some
chocolates to her colleagues. She is biased towards her friends and plans to give them more than
the others. One of the program managers hears of this and tells her to make sure everyone gets
the same number.
To make things difficult, she must equalize the number of chocolates in a series of operations.
For each operation, she can give 1,2,5 pieces to all but one colleague. Everyone who gets a
piece in a round receives the same number of pieces.
Given a starting distribution, calculate the minimum number of operations needed so that every
colleague has the same number of pieces.
Problem Link:
https://www.hackerrank.com/challenges/equal/problem?isFull%20Scr%20een
=true
4. Kingdom Division
Problem Statement: - King Arthur has a large kingdom that can be represented as a tree, where
nodes correspond to cities and edges correspond to the roads between cities. The kingdom has a
total of n cities numbered from 1 to n.
The King wants to divide his kingdom between his two children, Reggie and Betty, by giving
each of them 0 or more cities; however, they don't get along so he must divide the kingdom in
such a way that they will not invade each other's cities. The first sibling will invade the second
sibling's city if the second sibling has no other cities directly connected to it
Problem Link: -
https://www.hackerrank.com/challenges/kingdom-division/problem

5. Down to Zero: -
Problem Statement:
You are given Q queries. Each query consists of a single number N. You can perform any of the
operations on in each move:
1: If we take 2 integers a and b
where
2: Decrease the value of N by 1.
2.
Determine the minimum number of moves required to reduce the value of N to 0.
Input Format
The first line contains the integer.
The next lines each contain an integer, N.
Problem Link:
https://www.hackerrank.com/challenges/down-to-zero-ii/problem

Experiment-10 Mini-Project Development and Implementation


Mini- Project

e. References

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


Ronald L.Rivest, and Clifford Stein.
2. Algorithms Unlocked” byThomas H. Cormen
3. “Data Structures and Algorithms Made Easy: Data Structures and Algorithmic
Puzzles”by Narasimha Karumanchi.
4. “Grokking Algorithms: An illustrated guide for programmers and other
curious people”by Aditya Bhargava

f. Assessment Pattern - Internal and External


The performance of students is evaluated as follows:

Theory

Components Continuous Semester


Internal End
Assessment Examination
(CAE) (SEE)

Marks 60 40

Total Marks 100

g. Internal Evaluation Component


Sr. Type of Weightage of actual Frequency of Final Weightage in Remarks
No. Assessment conduct Task Internal
Assessment
1. Conduct 10 Marks per 1 per 60 Marks per
Practical practical course
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

i. 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
Advance 3 3 2 2.3 3 2 - 1 2 1.5 3 2.5 -
22CSP-314 Programming 2
Lab – I
Beyond Syllabus

1. Hackathons and Coding Competitions:

Platforms: HackerRank, Codeforces, LeetCode


Concepts: Algorithm optimization, problem-solving, teamwork.
Resources: "Competitive Programming" by Steven Halim, Felix Halim
"Introduction to Algorithms" by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein
(Mapped with CO4,CO5)
Online Courses and Certifications:

Platforms: Coursera, edX, Udacity, Pluralsight


Concepts: Diverse specializations, project-based learning.
Resources:
Coursera's Specializations in various advanced programming topics
edX's MicroMasters programs (Mapped with CO4,CO5)

Machine Learning and AI:

Languages/Frameworks: Python (TensorFlow, PyTorch), R


Concepts: Neural networks, reinforcement learning, data preprocessing.
Resources:
"Deep Learning with Python" by François Chollet
"Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow" by Aurélien Géron
(Mapped with CO4,CO5)
Web Development Frameworks:

Languages/Frameworks: Django (Python), Ruby on Rails (Ruby), Node.js (JavaScript), Flask (Python)
Concepts: MVC architecture, RESTful APIs, full-stack development.
Resources:
"The Django Book" by Adrian Holovaty and Jacob Kaplan-Moss
"Eloquent JavaScript" by Marijn Haverbeke
(Mapped with CO4,CO5)

You might also like