ADS4

TwitterFacebook
Get flash to fully experience Pearltrees
Generally, to find a value in unsorted array, we should look through elements of an array one by one, until searched value is found. In case of searched value is absent from array, we go through all elements. In average, complexity of such an algorithm is proportional to the length of the array. Situation changes significantly, when array is sorted. If we know it, random access capability can be utilized very efficiently to find searched value quick. Cost of searching algorithm reduces to binary logarithm of the array length. http://www.algolist.net/Algorithms/Binary_search

BINARY SEARCH ALGORITHM (Java, C++) | Algorithms and Data Structures

public member function <string> Compare strings http://www.cplusplus.com/reference/string/string/compare/

string::compare

Divide in half A fast way to search a sorted array is to use a binary search . The idea is to look at the element in the middle.

C++ Notes: Algorithms: Binary Search

http://www.fredosaurus.com/notes-cpp/algorithms/searching/binarysearch.html
This is another topic we get asked quite a bit. - How do I do a 2D/3D Array? When I also started working with multi-dimensional arrays I found it hard to find the answers I wanted too. So I'll post up some info that will hopefully help other people. I'll go over both of the 2 major methods (Vector vs Pointer). http://www.cplusplus.com/forum/articles/7459/

Multi-Dimensional Arrays

what do you want to know about it? c++ objects are normally passed by reference to avoid expensive duplication and to let other functions use the same object as the calling function. class MyClass { // blabla }; void foo ( MyClass & obj ) { // class passed by reference } int main () { MyClass myclass ; // create an instance of the class foo ( myclass ); // pass it to another function } Ancient Dragon Achieved Level 70 31,833 posts since Aug 2005 http://www.daniweb.com/software-development/cpp/threads/135572/passing-objects-as-function-parameters

passing objects as function parameters - C++