lets say i have a array. how many different way can i look up a value. for ex

one way would be use forloop and go though every element untill u find your value.
2nd way is binary search.
are there more? if so can you let me know the names so i can learn tehm.

Recommended Answers

All 2 Replies

A third way is to use a hash index. Once the hash is computed for the target value, it is usually a single probe to see if the value exists in the collection. The only thing that may interfere with that is a hash collision. I'm sure you can find some good articles on hash tables in the Wikipedia.

i still in school and we been using arrays, linklist and binary trees so far. in real world do people use arrays alot? or hash tables? or linklist? or binary trees.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.