0% found this document useful (0 votes)
31 views

Array Assignment

The document lists 12 array problems to implement or solve: 1) Implement selection, insertion, and bubble sorts. 2) Binary search. 3) Print sum of positive and negative numbers separately. 4) Find intersection of two arrays. 5) Find pairs in an array that sum to a given value. 6) Add two arrays and return sum array. 7) Find duplicate number in array with numbers from 0 to n-2. 8) Find triplets in array that sum to given value. 9) Add two arrays and return sum array. 10) Find duplicate number in array with numbers from 0 to n-2. 11) Find number of rotations in rotated sorted array. 12) Sort 0s and 1s array in

Uploaded by

tatti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Array Assignment

The document lists 12 array problems to implement or solve: 1) Implement selection, insertion, and bubble sorts. 2) Binary search. 3) Print sum of positive and negative numbers separately. 4) Find intersection of two arrays. 5) Find pairs in an array that sum to a given value. 6) Add two arrays and return sum array. 7) Find duplicate number in array with numbers from 0 to n-2. 8) Find triplets in array that sum to given value. 9) Add two arrays and return sum array. 10) Find duplicate number in array with numbers from 0 to n-2. 11) Find number of rotations in rotated sorted array. 12) Sort 0s and 1s array in

Uploaded by

tatti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Arrays Assignment

1. Implement Selection, Insertion and Bubble sorts.


2. Binary Search
3. Print sum of all positive and negative numbers seperately in an array
4. Given two arrays print their intersection.
a. Instead of printing write a function which returns their
intersection.
5. Given an array of integers A and an integer x. Find pairs of elements in
a. A which sum to x.
6. You are given two arrays. Find the sum of the two arrays and put the
a. result in another array. e.g. if you are given [1,2,4] and [4,5,6] the
b. output should be [5,8,0].
7. Find the duplicate number in an array of size n with numbers from 0 to
n-2. Each number is present at least once.
8. Given an array of integers A and an integer x. Find triplets of elements in
A which sum to x
9. You are given two arrays. Find the sum of the two arrays and put the
result in another array. e.g. if you are given [1,2,4] and [4,5,6] the output
should be [5,8,0].
10.Find the duplicate number in an array of size n with numbers from 0 to
n-2. Each number is present at least once.
11.A sorted array has been rotated by some number k in clockwise
direction. Find k. e.g. Input: 5,6,1,2,3,4 Output: 2
12.You are given with an array containing only 0’s and 1’s. Write a function
to sort this array. Do it in one pass, this means you can’t first find the
count of 0’s and 1’s in one pass and update the array in second pass.

You might also like