{"id":206,"date":"2014-06-19T23:28:56","date_gmt":"2014-06-20T07:28:56","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=206"},"modified":"2014-06-19T23:28:56","modified_gmt":"2014-06-20T07:28:56","slug":"interview-questions-from-pinank","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=206","title":{"rendered":"Interview questions from Pinank"},"content":{"rendered":"<p>here are the questions:<br \/>\n1. Given a library of Stack with 2 functions (push(x), pop()), implement a queue library (i.e. enqueue(x), dequeue())<br \/>\n    Use 2 stacks:<br \/>\n    enqueue() : keep push(x)ing in Stack1 only<br \/>\n    dequeue() : keep pop()ing from Stack2 only. (Incase Stack2 is empty, pop() everything from Stack1 to push() into Stack2) and then pop() from Stack2<\/p>\n<p>2. Explain working of HTTP protocol (some people answer in quite detail (about DNS lookup, TCP handshake, etc.)<\/p>\n<p>3. How can you implement a HashTable?<br \/>\n    Use an &#8216;Array&#8217; to store values. (Each array element is actually a linked-list, so 2 values having same key can be inserted at the same-element in the Array.<br \/>\n    Also need 2 functions:<br \/>\n    a) to get hash-key (to decide where to store the element in the array)<br \/>\n    b) compare() : I forgot the exact reason, but i think its used for resolving collision. (In Java they also store the &#8216;key&#8217; along with the object&#8217; instead of just storing the object and this compare() function is then used .. i&#8217;ll try to find the document that has more details on how its used..<br \/>\n    c) Some people also ask what are good options of hash-functions ? (it will depend on type of data, but some common options are &#8216;mod&#8217; function) e.g. 57 mod 8 =  1 (if array size is 8) ..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>here are the questions: 1. Given a library of Stack with 2 functions (push(x), pop()), implement a queue library (i.e. enqueue(x), dequeue()) Use 2 stacks: enqueue() : keep push(x)ing in Stack1 only dequeue() : keep pop()ing from Stack2 only. (Incase Stack2 is empty, pop() everything from Stack1 to push() into Stack2) and then pop() from &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=206\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Interview questions from Pinank<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-206","post","type-post","status-publish","format-standard","hentry","category-interview-questions"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=206"}],"version-history":[{"count":1,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/206\/revisions"}],"predecessor-version":[{"id":207,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/206\/revisions\/207"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=206"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}