Hello guys, I've got a question related to my data structures class.

I have file in which data is unordered. Say:

hello
apple
blue
phone
number

I have to search a string using Binary Search. But since we cannot apply Binary Search to unordered list, we should make an ordered list using some sorting algorithms.

However, main point of my assignment is making an ordered list without using any sorting algorithms and then apply Binary Search.

Question is how can I make data in my file an ordered?

Any help will be highly appreciated!

Recommended Answers

All 2 Replies

Do you have the exact wording of the problem? You cannot turn an unordered list into an ordered one without sorting it.

Do you have the exact wording of the problem? You cannot turn an unordered list into an ordered one without sorting it.

Yep, not unless you obscure the meaning of "sorting".

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.