amitvyasg
BAN USERI am not assuming lists are equal, probably didn't communicate properly. If one of the will be added to next element and we will carry on with the single list for creating the new one.
I see both danielpiedrahita's and my last solution as the same in nature. Just that for me stack is implemented as a reverse linked list. How are you planning to implement the stack?
Another solution could be
Create reverse of the two linked lists(rev1, rev2)
Now we can easily run through these lists rev1, rev2 element by element and do additions of their corresponding values to create a new list rev3.
Also make sure to pass the carries to next element. In the end if we have carry but both lists have exhausted, we will need to create a new element for the carry also in rev3.
Reverse this new list rev3 to get the final answer.
This solution does require additional space to store the intermediate reverse lists.
As I understand
- amitvyasg January 25, 20121) If frame does not have switch mac address than as in a regular switch it will be unicasted/broadcasted based on whether the destination mac is learned.
2) If packet does have a destination mac of the switch or of one of its ports or its an broadcast frame, and also has L3 data, than it will be given to L3 layer, which can do many actions like
a) If its an Arp request for the switch's IP, it responds the arp with its mac address
b) route the packet, if switch is also working as a router.
In case of an broadcast frame will still be broadcasted by the switch, along with it handling the L3 data(say Arp request).
3)
a) In case a frame is destined to mac address of switch or one of its ports and it does not have L3 data. I am not sure how to handle this case and whether it is practically seen.
b) case where frame is an broadcast frame without L3 data. In this case it can be broadcasted, but I am not sure about the usecase for it.