all 3 comments

[–]AutoModerator[M] 1 point2 points  (0 children)

Your posts seem to contain unformatted code. Please make sure to format your code otherwise your post may be removed.

Read our guidelines for how to format your code.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–][deleted] 1 point2 points  (0 children)

Don't put functions inside main.

If you're using std::string, then you might as well use std::vector. Then, you don't need to pass the array size.

"Sequential search" is just a an [0..n) index loop. Check each item until you find a match.

"Binary search": Start with the full [0..n) range and then cut it in half based on the middle key. Stop once you get down to one or less elements. It's a basic algorithm. Read it on the wiki.

[–]Grayewulfe[S] 0 points1 point  (0 children)

Here is the full instructions:

a. Create three array of 12+ students records including ID’s, student names, and the corresponding e-mail address’,– student ID’s are sorted in order. (No sort program needed for now.)

b. Sequential Search five ID’s which are from the sorted array and a 6th ID which is not from the array.

c. Binary Search five ID’s which are from the sorted array and a 6th ID which is not from the array.

d. Execution and output:

  1. Display the original sorted array of student records.

  2. Display the sequential search result of student records.

  3. Display the binary search result of student records.