More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Yes we can. But as the underlying structure of the collection class is double linked list, it will eventually have to traverse to the element linearlly and hence would result in bad performance.
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve CorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
_{}
Q43. If a stack is implemented using an array, which end (head or tail) should represent the top ?
^{This question was recently asked at 'One Click Retail'.This question is still unanswered. Can you please provide an answer.}
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve tree data structure maximum depth of tree Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
_{}
Q49. What can we do if we need to retrieve Fibonacci value at a particular index faster ? Can we use Linked List ?
^{This question was recently asked at 'Canopy Tax'.This question is still unanswered. Can you please provide an answer.}
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve LinkedList Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
_{}
Q50. How will you implement your own custom hashmap and linkedlist ?
Ans. The array index starts with 0 because program locates an element using the expression ( BaseAddress + ( Index * size of array Element ), where index is used as an offset. As the starting address is actually the address of first element, the index of first element is used as 0 and so on.
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve CorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
_{}
Q52. Why does an array need continuous memory locations and not Linked List ?
Ans. Array needs continuous memory location because it need to provide random access of it's elements which is not required for Linked List.
Array index acts as an offset from the base address and hence can retrieve the respective element using the expression Base Address + ( Index * Element Size ). This expression could only hold true if the elements are in continuous memory location.
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve CorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
^{This question was recently asked at 'Reddit'.This question is still unanswered. Can you please provide an answer.}
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve Maximum subarray variant arrays sub array subarray Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
Ans. Work with two pointers on the linked list - a slow pointer (increments by one node) and a fast pointer (increments by two nodes). If both of these pointers meet at the same node, then there is a cycle in the linked list. Otherwise, no cycle.
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve linkedlist Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
_{}
Q62. Implement a Stack with 2 threads in which one thread push data and another pop data.
^{This question was recently asked at 'Overstock.com'.This question is still unanswered. Can you please provide an answer.}
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve data structure algorithm Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
^{This question was recently asked at 'IBM India'.This question is still unanswered. Can you please provide an answer.}
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve queue stack Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
^{This question was recently asked at 'Tata Consultancy (TCS)'.This question is still unanswered. Can you please provide an answer.}
Help us improve. Please let us know the company, where you were asked this question :
_{ Like Discuss Correct / Improve message queue Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}
_{}
Q69. What is the time complexity and space complexity of reversing a Linked List ?