Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
34 views2 pages

Lab Assignment 2

The document outlines 4 questions regarding data structures and algorithms assignments using C++ or Java. Question 1 asks to write functions for array operations like display, add, insert, delete, search, and rotate. Question 2 covers checking if an array is sorted, merging arrays, and set operations. Question 3 focuses on finding elements in arrays like singles, duplicates, and pairs summing to k. Question 4 provides linked list problems like displaying, counting, searching, deleting, sorting, merging, concatenating, and reversing lists along with circular and doubly linked lists.

Uploaded by

Amit Vishwakarma
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)
34 views2 pages

Lab Assignment 2

The document outlines 4 questions regarding data structures and algorithms assignments using C++ or Java. Question 1 asks to write functions for array operations like display, add, insert, delete, search, and rotate. Question 2 covers checking if an array is sorted, merging arrays, and set operations. Question 3 focuses on finding elements in arrays like singles, duplicates, and pairs summing to k. Question 4 provides linked list problems like displaying, counting, searching, deleting, sorting, merging, concatenating, and reversing lists along with circular and doubly linked lists.

Uploaded by

Amit Vishwakarma
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/ 2

Lab Assignment 2

UCS 406 Data Structures and Algorithms


Note: Use C/C++ or JAVA programming language.

Q1. If a one dimensional integer type array with its size and length given, write the code in C++
language to create functions to perform the following operations (Please assume whatever
is necessary to examplify the results) :

i. Display()
ii. Add/Append(x)
iii. Insert(index,x)
iv. Delete(x)
v. LinearSearch(s)
vi. BinarySearch(x)
vii. Get(index)
viii. Set(index,x)
ix. Max()
x. Min()
xi. Reverse()
xii. Shift()
xiii. Rotate()

Q2. For a given array, write functions to perform the following:

i. Check if an array is sorted


ii. Merge arrays
iii. Set operations on array: Union, Intersection

Q3. For a given array, write functions to perform the following:

i. Finding single element in an array


ii. Finding multiple elements in an array
iii. Finding duplicates in a sorted array
iv. Finding duplicates in an unsorted array
v. Finding a pair of elements with sum k
vi. Finding a pair of elements with sum k in sorted array
vii. Finding max and min in a single scan

Q4. For a given Linked List (LL), write programs to perform the following functions

i. Display the elements of a LL


ii. Count and sum the nodes of a LL
iii. Search for a key element in a LL
iv. Delete an element from a LL
v. Check if a LL is sorted
vi. Merge 2 LLs
vii. Concatenate 2 LLs
viii. Reverse the elements of a LL
ix. Create and Display a circular Ll
x. Create a doubly LL, insert in a doubly LL and reverse a doubly LL.

You might also like