Write test cases for delete numbers found in list2 from list1 and returns new list1 length?
Software QA/Tests Interview Questions from Microsoft
(Continued from previous question...)
Write test cases for
delete numbers found in list2 from list1 and returns new list1 length?
Q:
Microsoft Interview Question for SDE in tests about C
Write test cases for
delete numbers found in list2 from list1 and returns new list1 length?
A:
int deleteDuplicates(int *list1, int length1, int *list2, int length2)
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
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.
(Continued on next question...)
Other Interview Questions
|