CSC205_Quiz5PracticeProblems

# Note 23342

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: uot;pair" is two consecutive locations in the array having the same value. (Note: {2, 3, 3, 4, 2} has a pair 3, 3. But, {4, 5, 2, 9, 2} doesn't have a pair). Find if the array a has a pair in it. e. Find if any two values in the array are the same (i.e. a has a repeated element). For example {2,3,3,4,2} has two repeated elements but {4,5,2,9,6} doesn't have repeated elements. f. Find how many times a certain number x appears in the array a. For example, if a = {2, 5, 3, 4, 5, 4, 5} and x = 5, the answer would be 3. g. Find if there are any numbers common between arrays a and b. For example, if a = { 2, 4, 1, 5} and b = {1, 6, 8. 7} they have a number in common, namely 1. If a = {1,2,3,4} and b = {5,8,7,9} they don’t have anything in common. h Assuming both a and b are sorted in increasing order, decide if any element of a is less than any element of b....
View Full Document

## This note was uploaded on 01/10/2014 for the course CSC 205 taught by Professor Dr.t.m.rao during the Spring '12 term at SUNY Brockport.

Ask a homework question - tutors are online