↳
I suggest to create additional pointer which is the tail. Set a gap of the n nodes between the head and tail, move both, and once the tail points to null it’s the end of the list. Then, move only the head and print the node until it reaches the tail Menos
↳
Actually, that could work but it's too expensive. I suggest you to reverse the list which take O(n) time complexity afterward print first m element and reverse the list back which in total cost you O(n) time complexity and O(1) extra space Menos
↳
Use a queue. Traverse the list and add each element to the queue. Always check if the size of the queue is n, if so then remove the first element before adding a new one. When you finish traversing the list your queue will have exactly the last n elements of the list, just print them in order. Menos
↳
computer suddenly powers off what do you do.
↳
I think the hardest part for me was on the algorithmic ones.
↳
- The current contents of registers are placed on the stack. - The current program address is placed on the stack. - The Interrupt Vector Table is checked to determine the source of the interrupt, and which Interrupt Service Routine it should go to. - At the end of the ISR, the interrupt flag must be cleared for normal operation to continue. Menos
↳
I talked about random access property of array vs sequential for SLL. Also talked about how SLL is better for dynamic data as a dynamic array requires resize/copying. Lastly, I said an array is better in loops because the dereferencing of an SLL would have more overhead. He also wanted me to say something about an array being contiguous in memory, but I didn't get that... Menos
↳
if(a + sizeof(a)) > B) && ((B+sizeof(B)) > A)
↳
coding question was easy with 45 mins to spare, could take care of all debug aspects. Theory questions were all easy as well, except code analysis. Menos
↳
Another C++ question is about template metaprogramming.
↳
I didn't get this correct so he never told me the answer, but I'm sure it is something along the lines of fork(), execve(), system calls, etc... Menos