.. (לתיקייה המכילה) | ||
[BUG FIX, original version] Shouldn't the third argument in the signature of the function in q2 be the size of the telephone book? | |
Yes, the correct signature is: int search_tb(char* name, char** tb_names, int num_entries, char* alphabet) |
In question 2, does the string have to match the entire first name, or can it be a partial match only? | |
Part of the name is OK as well, so for the telephone book given in the assignment, if you type M, you'll get Michael Elad 4169 Michael Heymann 4163 Michael Kaminski 4360 Michael Lindenbaum 4331 Michael Shmoish 4302 Miri Ben-Chen 4347 |
Can two people have the same phone number? | |
No |
What is the range of the phone numbers? | |
Assume that each phone number is composed of 4 digits, so the range is 0-9999 |
In question 4, when removing, do i remove by name or by number? | |
By number, you should be able to rely on your implementation of question 3 |
In question 4, do we have to use malloc in order to have space for the new names? | |
You can, but you don't have to. Consider the following idea: create a global (or static) array with enough space for filling all names that may be added, and keep a pointer to the next empty location in the array. Each time you can read the name to the next empty location in the array (using the pointer) and advance the pointer until after the name. |
What is the correct order for the following names: "Michael Shmoish","michael Elad" and "Elad Haramaty", is it | |
The second option is the correct one. The rules, as given in the assignment, are: - when two lowercase letters are compared we use the order given by the alphabet - when two uppercase letters are compared we use the order given by the alphabet - In all other cases we use the ASCII value for the comparison. In particular, when you compare a lowercase (m) and an uppercase (M) letters you use their ASCII values. |
Is it possible to assume that names contain only letters? | |
No. You may only assume that first and family names are two words divided by a space or a tab. |
Can we hand questions 3 and 4 in one file? | |
Yes. |
Can we assume the O(10,000) = O(1)? | |
Well, in the general case you can. However, in this case it is obvious that n never goes beyond 10,000 so it is more appropriate to assume that O(10,000) = O(n). |
Am i allowed to use strcpy()? | |
Yes. |
Should we treat also telephone numbers that begin with 0? | |
Dealing with telephone numbers that begin with 0 is a little bit tricky when you try to add them to the telephone book in the code, e.g. by replacing the first telephone number from 4892 to 0032. The compiler treats numbers that begin with 0 as octal, which will means that 0032 in octal base will turn to 26 in decimal base. Therefore, you should take numbers that begin with 0 into account, but you don't have to test them (e.g. by trying to add a telephone number that begins by 0). |
What is the function "digit" in ex5.c supposed to do? | |
Sorry, this should not be there, fixed that :) |