# Describe how to put a pile of books in alphabetical order by author.

• 1)Alphabetize using the first four letter of the last name.
• a) arrange in order starting the letter A.
• 2)Look for any author's with identical last, if found
• a)alphabetize the group of last names by looking at the first three letters of the first name,
• 3)Look for any author's with the same last and first name.
• a) if any, alphabetize by the initial.

Second solution

Create an array with two records(last and first name of author) and third one, if there is a middle initial.

Search through the records of last names. Using the letter A as the first value and letter Z as the last, arrange accordingly bringing along the other two records.

If there are any identical last names, look at the second record. Arrange these records using A as the first vaule and Z as the last. set the value closest to A ahead of the other identical names on list.

If there are any identical first and last name records, use the third, if one is present, to arrange. Once again, A is first and Z is last. Set the value closest to A or with no middle initial ahead of the other identical records.

## Cathy

1. scan the stack for any authors' last names beginning with A, place these in a group at the top of the stack.

2. scan the stack for any authors' last names beginning with B, place these in a group below the previous group.

3. repeat step 2 for letters C-Z.

4. scan the stack for any groups with more than one book.

• for each group with more than one book (i.e. more than one author's last name starting with the same letter) repeat steps 1-4 for the group (rather than the entire stack), each time, progressing to the next letter of the author's name, until no groups include more than one book (unless two author's names are the same, or two books are by the same person).

## Ivy

Describe how to put a pile of books in alphabetical order by author.

1) Locate the name of the author on the spine of book 1.

2) Determine the last name of said author.

3) Locate the name of the author on the spine of the next book.

4) Determine the last name of that book's author.

5) Look at the last names of both authors. Check to see if either one starts with the letter A. if so, place that book first in the pile. if not, continue through each of the letters in order from A-Z. whichever book's author's last name comes first will be placed in front of the other book. if both authors' last names start with the same letter, compare the next letter of their names, and so on and so forth.

6) okay, i've just realized that this algorithm, though not impossible, almost seems not worth the time to program. (okay, maybe i should be more specific. i just realized that i don't have the patience or energy to walk this algorithm all the way through.) this is one of my main issues with computers. i believe that overall they're great machines, but i don't believe it's always more efficient to allocate tasks to them that we can do ourselves. maybe this is what distinguishes me from computer scientists. i have no problem using computers for tasks they've already been taught how to do, but i get frustrated if i'm the one that actually has to do the teaching, or, less directly, the one who has to learn how to make the computer do what i know it's already been taught how to do (make labels on lotus 123, for example). so trying to write this algorithm has demonstrated to me that i am too impatient to be sufficiently thorough enough to make this algorithm work. i'm sorry. i really can't think of an easy or simple way to write this. If you already knew how to do it, what would the point be to being in the class? We'll consider ways to make it easier for you to write instructions.

## Jae

1.) Assign each alphabetic character a number in order of placement 1 - 26 (A =1, etc.)

2.) Provide the information to the computer in an elemental fashion, in an array where each element is Author Last Name, Author First Name, and Book Title.

3.) Begin with last name element, and divide the list so that the elements are now grouped in 26 numerical categories in order from lowest to highest according to the first letter (assigned a number).

4.) Now focusing on these groups individually, proceed through each as follows, and always keeping items of the elements together:

• A. Place the elements in the category in order according to the second letter of the last name, using the numerical assignment made earlier.
• B. Check for duplicates so far. If there are none, move on to the next group in linear order and begin step A again.
• C. If there are duplicates, place only the duplicated elements in order according to the next letter of the last name, using the numerical assignment made earlier, and repeat B.
• D. Continue the process until there are no duplicates in a group, moving to the second item (Author First Name) in each element if two Author Last Names are identical item duplicates, and then proceed to each group until group 26 is finished.
• E. "Print" results decoded from numbers to letters, and place books in order.

## Jeana

1. Sequentially assign a numerical value to each letter of the alphabet A-Z, beginning with A=1, and going through to Z=26.

2. For each book, identify the first letter of the author's last name.

3. For each of the letters identified in step 2, identify its numerical value.

4. Sort the books by number.

5. Arrange the books/groups of books in numerical order from smallest to largest, from left to right.

6. Within each group: (applicable only when there is more than 1 book):

• a. identify the second letter of the each author's last name.
• b. identify each letter's corresponding numerical value.
• c. based on these values, arrange books numerically within the grouping.
• d. if the values of the second letter are equal, repeat steps 6a-6c using the third letter of each author's last name for whom the values match.

## Jeff

Assume: the beginning of the alphabet is on the left side. 1.) Starting on the left moving to the right of unorganized books, select the author that is closest to letter A by

• 1.1 selecting a book,
• 1.2 comparing the selected book to the book on the right of the selected book
• 1.3 if selected book is closer to the beginning of the alphabet, then compare the selected book with the next book directly to the right of the book it was just compared to and has not been previously compared to or if the selected book is not closer to the beginning of the alphabet swap the selected book with the book closer to the beginning of the alphabet and begin at 1.2

2.) Remove the selected book from the self and replace the book on the left hand side of the shelf after the book that was previously selected. For the first book, place the book against the self on the left side. For each additional book place on the right of the previously organized books. For books with multiple author's select the first author listed.

Jeff's Second Solution

Gather all books that begin with the letter X , where X=the first letter of the alphabet

Select books from gathered books

Compare the author's last name by assigning: _ is closer to the beginning of the alphabet than a; a is closer to the beginning of the alphabet than b; b is closer to the beginning of the alphabet than c; ...; y is closer to the beginning of the alphabet than z

Choose the author's last name that is closer to the beginning of the alphabet and place that book on the left side of the other book

Choose another book from gathered books

Compare the author's last name

Place the book to the right of the book it immediately follows in the alphabet or if the book is first alphabetically, then place the book on the left of the book that previously was the first alphabetically.

Repeat this process for all books that begin with letter X.

Take all the books that begin with the letter X and place them on the self in the same order they are arranged.

If there are no more gathered books with respect to letter X, then gather all books that begin with letter X+1

Gather all books that begin with letter X+1, where X+1=the second letter of the alphabet

Gather all books that begin with letter X+N, where X+N=a letter of the alphabet

Stop when N=25

The function is most effective when the number of entries is below 100. If the number of entries is above 1000 it would be more effective to group with the first two letters of the name such as AA, AB ...

## Joel

1. Enter each author's name (last name first) along with their corresponding book title.

2. I'm not sure how, but somehow make sure that each author's book title stays attached/connected to the author at all times, no matter where it is moved to.

3. Assign the first letter through the last letter in each author's full name (last name first) to a corresponding number (e.g. A = 1, B = 2, ...).

4. Put the numbers (i.e. the letters) in order from smallest to greatest, starting with the first letter in the author's last name and going to the last letter in his/her first name.

5. If two numbers are the same for first letter, then one need's to go to the next letter, and continue until the numbers (letters) are not equal.

6. Continue this process until all the numbers are in order from smallest to largest, and therefore, putting the author's names (and their corresponding book titles) in alphabetical order.

## Kevin

1. Names of authors are generally located on the covers of books. For each book, find the author's name. If the author's name is on the cover, then write down the name of the author on a sheet of paper. If not, then look to the "title page" in the front of the book. The author's name should be under the title of the book. Write down the name of the author on a sheet of paper.

2. Continue doing this for all books in the pile (use the same sheet of paper)until all the authors have been written down. If the same author wrote different books within the pile, be sure to write the title of each book with its corresponding author name on the list.

3. Alphabetize the list by author's last name from A to Z. If the same author wrote different books within the pile, when that author's name arises, then alphabetize those books by book title, but only within the books written by that particular author.

4. Locate the bookshelf which is to house the books.

5. Place the first book of the list on the upper-most shelf available, at the left-most position available. Stand the books so that the front of the book faces right and the bottom is used as a base on which to support the book.

6. Place the second book of the list on the shelf immediately to the right of the first book. Continue in this manner with each book of the list until the top shelf is full.

7. Upon the filling of the previous shelf, place the next book of the list on the shelf just below the previous shelf used, at the left-most position available.

8. Continue with steps 5-7 until no more bookshelf space is available or there are no more books to place on the bookshelf.

9. If there is no more bookshelf space available, either find another bookshelf(shelves) for the remaining books or if none is available, use a section of floor for the remaining books, and continue with steps 5-7 until no more books remain, and continue to use up new floor space and/or new shelf space until no more books remain.

## Liz

For each book b, consider b.lastname mid=middle of alphabetical section being compared.

1. For first book,

• if b.lastname=mid or if b.lastname>mid set book in stack B and go on to next book.
• else put book in stack A.

2. repeat with rest of books, until all books are either in stack A or stack B.

3. Next, consider stack A. Repeat step one, creating stacks C (lower than mid of stack A) and D (higher than mid of stack A).

4. Repeat step one with stack C. Continue this process until stack x contains one book with lowest value letter. Return that book as first book in list. If more than one book with lowest letter as author's last name, repeat step 1 using second letter in name.

5. Go through remaining stacks, starting with the next lowest stack (what should also be the smallest) and continue to sort using step 1 and following process of step 4 to find book with next lowest letter value, which will be the second, third, fourth, etc. items in list.

## Sam

1. Accquire a reference list that is composed of an ordered "alphabet." the letters should be ordered in a series that begins with A and concludes with Z, reading as such: ABCDEFGHIJKLMNOPQRSTUVWXYZ.

2. Find the authors' names on all of the books you have to arrange. Note the location for easy reference.

3. Separate the books into piles based on first letters of the authors last name, grouping names with common first letters together. If groups are formed with more than opne book, consult the second letter to place them, the thirs if necessary and so forth. If authors have identical last names, letter for letter, consult the first names for ordering.

4. Prepare to begin stacking the books. You want to end up with the letters at the beginning of the "alphabet" on the top of the pile, so the end letters will form the base of the pile. Find authors' names that correpond with the letter Z and place them. If there are no Z's, move to the previous letter, Y. Continue this process until you have reached the end of stack and the beginning of the alphabet. You should now have an alphabetized stack of books.

Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS105/2000S/Questions/question.11.html

Source text last modified Sun Feb 13 09:55:45 2000.

This page generated on Wed Feb 16 08:36:16 2000 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu