Purchase Solution

Describe an Algorithm

Not what you're looking for?

Ask Custom Question

The question is attached and there are some clarifications

1. The integers are NOT sorted and you CANNOT sort them. You need to see if the numbers would match the pattern if you were to sort them.
2. a and b can be any integer and we don't know the values in advance.

Attachments
Purchase this Solution

Solution Summary

The solution describes an algorithm.

Solution Preview

The basic idea is to find a and b in O(n) time.
Here is the description of the algorithm, with input array A[1..n] of n integers.
Step 1: Find the smallest element y1 in A[1..n], this will take O(n) time.
Step 2: Find the largest element y2 in A[1..n], this will take O(n) time
If y1=y2, then return true. ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic Networking Questions

This quiz consists of some basic networking questions.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.