Hello this is my project. Because I do not know how to define which file is marked sort or unsort when input file.(I already have 2 file sort and unsort of 2 d array) The next thing is how to apply the linear search for 2 dimension array .And How to apply the binary sort for 2 dimension array. I just have some question like that. I just want to know the technique how to apply 2 way search for 2d array. Thank you
Write a function to prompt the user for the name of a text file to read in the two dimensional array of long double data type.
Load in the data for the two dimensional array.
Prompt the user to enter the column they wish to search by (check to make sure the file is "marked" as "SORTED" - if the file is marked as "UNSORTED" do not allow a binary search to be done, but rather in this case, utilize linear search), and the value to find. Implement the binary search algorithm to find the value (remember, the column they specify must be sorted or binary search may not always work). You will have to come up with some technique to be able to determine if the user has the column sorted in smallest to largest, or largest to smallest sort order in order to use binary search correctly (the algorithm in class only works for sorted data that is sorted from smallest to largest).
You come to my house over the weekend and we'll have some fun. I'll show you how I use my fingers to make functions that'll make your spine tingle. Oh yea, the way I print to the screen will make your mouth water and eyes open wide with excitement. I'll unzip my pants and take out my long double two dimensional array and I'll stick it right into your unsorted file. You'll scream out, "zapshe! Oh zapshe! The way you you use linear search! Oh God!" And just when you think we're finished, I'm gonna spin you around and search through every inch of you to find the value we're looking for.
Because I do not know how to define which file is marked sort or unsort when input file.
I assume it'll either say it as the first line or something. Just use the stream to look at the words until you come across the one that tell you whether or not it's sorted.
How to applay the binary sort for 2 dimension array.
You aren't. You're going to do a binary search. This depends on how the array is sorted. You'll want to start by taking in a value from two columns, check which is bigger to determine how the it's sorted.
Once you've done that, you can use binary search by determining HOW each column separates the values. For instance, maybe it goes to a new column every 10 increments. Since there's no information in your question, we can't give you specifics, but this should be enough to give you an idea.
C++ is a general purpose programming language and widely used now a days for competitive programming. It has imperative, object-oriented and generic programming features. C++ runs on lots of platform like Windows, Linux, Unix, Mac etc.