Binary Search of an array of three strings

Reply

Join Date: Oct 2006
Posts: 2
Reputation: jfinch99 is an unknown quantity at this point 
Solved Threads: 0
jfinch99 jfinch99 is offline Offline
Newbie Poster

Binary Search of an array of three strings

 
0
  #1
Oct 1st, 2006
I have a homework assignment that requires that I sort an array of Accounts that contains strings for ID, PIN, and balance. I believe that I need to sort the array based on the ID. And then I have to verify the ID that the user inputs to the accounts that have been read in using ifStream. How do I use Binary Search to compare strings?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,348
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1462
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Binary Search of an array of three strings

 
0
  #2
Oct 1st, 2006
there are several examples and tutorials. I suggest you use a structure to hold the data for one account then put the structures in an array. That helps keep all the data together when sorting and searching. The actual algorithm you are looking for is almost the same as shown in the link I posted. Just change the comparison to use string compares instead of integer compares.
Last edited by Ancient Dragon; Oct 1st, 2006 at 3:07 pm.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2
Reputation: jfinch99 is an unknown quantity at this point 
Solved Threads: 0
jfinch99 jfinch99 is offline Offline
Newbie Poster

Re: Binary Search of an array of three strings

 
0
  #3
Oct 1st, 2006
Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC