Interview Questions

Write test cases for delete numbers found in list2 ....

Microsoft Interview Questions and Answers


(Continued from previous question...)

93. Write test cases for delete numbers found in list2 ....

Question:
Write test cases for delete numbers found in list2 from list1 and returns new list1 length? int deleteDuplicates(int *list1, int length1, int *list2, int length2)


maybe an answer:


pseudo code
1. put list 1 in hash table
2. use a pointer, go from beginning to end of list 2 and do hash look-up. if there is a match, point current->next to current->next->next. delete current->next. move on to the next one and repeat til NULL.
3. count how many is left in list 2.



maybe an answer2:


1. lists of equal length
2. lists of unequal length
3. empty lists (both l1 and l2)
4. lists with all 0s or -ve numbers (both l1 and l2)
5. lists will non integer values
6. lists with repeating values in sorted and unsorted order

(Continued on next question...)

Other Interview Questions