Beruflich Dokumente
Kultur Dokumente
Goals
Demystify the interview process Go over common themes and problems Talk about personal experiences and answer any questions
My Background
thinking process pseudocode writing skills discuss time (Big-O) and memory complexities discuss unit tests discuss real life conditions and their impact on solution
Write a function that returns true when a cycle of length n exists; false otherwise
take n hops, if have visited each element once, return true; false otherwise
Big-O Notation
Big O notation is a way that programmers use to determine how the running speed of an algorithm is affected as the input size is increased. Big O is used to bound the worst case running time
When asked about the running time of a solution, you are most likely being asked about Big-O time. However, it never hurts to clarify, or say, in the average case X but in the worst case Y.
public static int listLength(Node pHead){ int counter = 0; while (pHead != null){ pHead = pHead.next; counter++; } return counter; }
a singly-linked node:
next value head
Linked Lists
next value next value next value next value null
a doubly-linked node:
next previous value head null next previous value next previous value next previous value next previous value null
What is the running time of your solution? Space complexity? What if we allowed you to mark nodes?
Check edge cases Check off by one errors Dont stress the syntax