0% found this document useful (0 votes)
52 views7 pages

DS Projects

This document contains 16 problems assigned to student teams. Each problem provides a brief description of a coding challenge and examples of inputs and outputs. The problems include writing functions to generate binary numbers, rearrange arrays, find next greater elements, remove duplicates from linked lists, rotate linked lists, merge two sorted linked lists, find pairs with a given sum in a doubly linked list, add linked lists, swap nodes in a linked list, check bracket balancing, reverse words in a string, find list intersections, print leaders in an array, push zeros to the end of an array, expression evaluation using stacks, and find maximums of contiguous subarrays.

Uploaded by

Sri vidya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views7 pages

DS Projects

This document contains 16 problems assigned to student teams. Each problem provides a brief description of a coding challenge and examples of inputs and outputs. The problems include writing functions to generate binary numbers, rearrange arrays, find next greater elements, remove duplicates from linked lists, rotate linked lists, merge two sorted linked lists, find pairs with a given sum in a doubly linked list, add linked lists, swap nodes in a linked list, check bracket balancing, reverse words in a string, find list intersections, print leaders in an array, push zeros to the end of an array, expression evaluation using stacks, and find maximums of contiguous subarrays.

Uploaded by

Sri vidya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

S.

NO ROLL NUMBER PROBLEM

1 228R1A6705 Given a number N, write a function that


(Team Leader) generates and prints all binary
228R1A6755 numbers with decimal values from 1 to
228R1A6730 N.
228R1A6704
Examples:
Input: n = 2
Output: 1, 10
Input: n = 5
Output: 1, 10, 11, 100, 101
2 228R1A6709 Given a sorted array of positive integers,
(Team Leader) rearrange the array alternately i.e first
228R1A6715 element should be a maximum value, at
228R1A6759 second position minimum value, at third
228R1A6751 position second max, at fourth position
second min, and so on.
Examples:
Input: arr[] = {1, 2, 3, 4, 5, 6, 7}
Output: arr[] = {7, 1, 6, 2, 5, 3, 4}
Input: arr[] = {1, 2, 3, 4, 5, 6}
Output: arr[] = {6, 1, 5, 2, 4, 3}

3 228R1A6711 Given an array, print the Next Greater


(Team Leader) Element (NGE) for every element.
228R1A6706
228R1A6701 The Next greater Element for an
228R1A6747 element x is the first greater element on
the right side of x in the array. Elements
for which no greater element exist,
consider the next greater element as -
1.
nput: arr[] = [ 4 , 5 , 2 , 25 ]
Output: 4 –> 5
5 –> 25
2 –> 25
25 –> -1
Explanation: except 25 every element
has an element greater than them
present on the right side
Input: arr[] = [ 13 , 7, 6 , 12 ]
Output: 13 –> -1
7 –> 12
6 –> 12
12 –> -1
Explanation: 13 and 12 don’t have any
element greater than them present on
the right side

4 228R1A6712 Write a function that takes a list sorted


(Team Leader) in non-decreasing order and deletes any
228R1A6729 duplicate nodes from the list. The list
228R1A6736 should only be traversed once.
228R1A6746
For example if the linked list is 11->11-
>11->21->43->43->60 then
removeDuplicates() should convert the
list to 11->21->43->60.
5 228R1A6713 Given a singly linked list, The task is to
(Team Leader) rotate the linked list counter-
228R1A6743 clockwise by k nodes.
228R1A6725
228R1A6724 Examples:
Input: linked list = 10->20->30->40-
>50->60, k = 4
Output: 50->60->10->20->30->40.
Explanation: k is smaller than the count
of nodes in a linked list so (k+1 )th node
i.e. 50 becomes the head node and 60’s
next points to 10
Input: linked list = 30->40->50->60,
k=2
Output: 50->60->30->40.

6 228R1A6714 AuxiliaryGiven two sorted linked lists


(Team Leader) consisting of N and M nodes
228R1A6702 respectively. The task is to merge both
228R1A6749 of the lists (in place) and return the
228R1A6733 head of the merged list.

Examples:
Input: a: 5->10->15, b: 2->3->20
Output: 2->3->5->10->15->20
Input: a: 1->1, b: 2->4
Output: 1->1->2->4

7 228R1A6726 Given a sorted doubly linked list of


(Team Leader) positive distinct elements, the task is to
228R1A6738 find pairs in a doubly-linked list whose
228R1A6739 sum is equal to given value x, without
228R1A6761 using any extra space

Example:
Input : head : 1 <-> 2 <-> 4 <-> 5
<-> 6 <-> 8 <-> 9
x = 7
Output: (6, 1), (5,2)

8 228R1A6732 Given two numbers represented by two


(Team Leader) lists, write a function that returns the
228R1A6720 sum in the form of a linked list.
228R1A6764
228R1A6738 Example:
Input:
List1: 5->6->3 // represents number
563
List2: 8->4->2 // represents number
842
Output:
Resultant list: 1->4->0->5 // represents
number 1405
Explanation: 563 + 842 = 1405
Input:
List1: 7->5->9->4->6 // represents
number 75946
List2: 8->4 // represents number 84
Output:
Resultant list: 7->6->0->3->0//
represents number 76030
Explanation: 75946+84=76030

9 228R1A6741 Swap nodes in a linked list without


(Team Leader) swapping data
228R1A6707
228R1A6757 Examples:
Input: 10->15->12->13->20->14, x =
228R1A6740
12, y = 20
Output: 10->15->20->13->12->14
Input: 10->15->12->13->20->14, x =
10, y = 20
Output: 20->15->12->13->10->14
Input: 10->15->12->13->20->14, x =
12, y = 13
Output: 10->15->13->12->20->14

10 228R1A6744 Given an expression string exp, write a


(Team Leader) program to examine whether the pairs
228R1A6727 and the orders of “{“, “}”, “(“, “)”, “[“, “]”
228R1A6731 are correct in the given expression.
228R1A6742
Example:
Input: exp = “[()]{}{[()()]()}”
Output: Balanced
Explanation: all the brackets are well-
formed
Input: exp = “[(])”
Output: Not Balanced
Explanation: 1 and 4 brackets are not
balanced because
there is a closing ‘]’ before the closing ‘(‘

11 228R1A6745 Given string str, we need to print the


(Team Leader) reverse of individual words.
228R1A6758
228R1A6737 Examples:
228R1A6723 Input: Hello World
Output: olleH dlroW
Input: Geeks for Geeks
Output: skeeG rof skeeG

12 228R1A6748 Given two lists sorted in increasing


(Team Leader) order, create and return a new list
228R1A6719 representing the intersection of the two
228R1A6760 lists. The new list should be made with
228R1A6722 its own memory — the original lists
should not be changed.

Example:
Input:
First linked list: 1->2->3->4->6
Second linked list be 2->4->6->8,
Output: 2->4->6.
The elements 2, 4, 6 are common in
both the list so they appear in the
intersection list.

Input:
First linked list: 1->2->3->4->5
Second linked list be 2->3->4,
Output: 2->3->4
The elements 2, 3, 4 are common in
both the list so they appear in the
intersection list.

13 228R1A6753 Write a program to print all the


(Team Leader) LEADERS in the array. An element is a
228R1A6750 leader if it is greater than all the
228R1A6765 elements to its right side. And the
228R1A6718 rightmost element is always a leader.
For example:
Input: arr[] = {16, 17, 4, 3, 5, 2},
Output: 17, 5, 2
Input: arr[] = {1, 2, 3, 4, 5, 2},
Output: 5, 2
14 228R1A6754 Given an array of random numbers,
(Team Leader) Push all the zero’s of a given array to
228R1A6710 the end of the array. For example, if the
228R1A6716 given arrays is {1, 9, 8, 4, 0, 0, 2, 7, 0, 6,
228R1A6708 0}, it should be changed to {1, 9, 8, 4, 2,
7, 6, 0, 0, 0, 0}. The order of all other
elements should be same. Expected
time complexity is O(n) and extra space
is O(1).
Example:
Input : arr[] = {1, 2, 0, 4, 3, 0,
5, 0};
Output : arr[] = {1, 2, 4, 3, 5, 0,
0, 0};
Input : arr[] = {1, 2, 0, 0, 0, 3,
6};
Output : arr[] = {1, 2, 3, 6, 0, 0,
0};

15 228R1A6756 Expression evaluation using stacks


(Team Leader)
228R1A6735
228R1A6721
228R1A6762
16 228R1A6763 Given an array and an integer K, find the
(Team Leader) maximum for each and every contiguous
228R1A6752 subarray of size K.
228R1A6717
228R1A6703 Examples:
Input: arr[] = {1, 2, 3, 1, 4, 5, 2, 3, 6}, K =
3
Output: 3 3 4 5 5 5 6
Explanation: Maximum of 1, 2, 3 is 3
Maximum of 2, 3, 1 is 3
Maximum of 3, 1, 4 is 4
Maximum of 1, 4, 5 is 5
Maximum of 4, 5, 2 is 5
Maximum of 5, 2, 3 is 5
Maximum of 2, 3, 6 is 6
Input: arr[] = {8, 5, 10, 7, 9, 4, 15, 12,
90, 13}, K = 4
Output: 10 10 10 15 15 90 90
Explanation: Maximum of first 4
elements is 10, similarly for next
4 elements (i.e from index 1 to 4) is 10,
So the sequence generated is 10 10 10
15 15 90 90

You might also like