Design an algorithm
Not what you're looking for?
You should post the "best possible" responses to the question. Remember that the main purpose of algorithm questions is to come up with the best possible algorithms through discussion. It is ok to write your responses using pseudocode, and there is no need to code & test using C++.
1. Design an algorithm for finding two closest numbers in the input list. What is the time complexity? Is it possible to improve the algorithm if the input is a sorted list?
Purchase this Solution
Solution Summary
Design an algorithm for finding two closest numbers in the input list. What is the time complexity? Is it possible to improve the algorithm if the input is a sorted list?
Solution Preview
Suppose the input list has n numbers. To find two closest numbers, we have to compare every two numbers in the input list. There are n(n-1)/2 = O(n^2) pairs of ...
Purchase this Solution
Free BrainMass Quizzes
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.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
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.
Javscript Basics
Quiz on basics of javascript programming language.