Data Structure - Interview Questions and Answers for 'Data structure' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 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.
Label / Company      Label / Company / Text

   



Data Structure - Interview Questions and Answers for 'Data structure' - 74 question(s) found - Order By Rating

next 30
 Q1. How to delete a node from linked list if u do not have head and only have a pointer to the element which has to be removed ?Data Structure
 This question was recently asked at 'LifCare'.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          Asked in 1 Companies


 Q2. How many threads can access a concurrent hashmap when the hashcode is overridden and always returns a zero.Data Structure
Ans. The impact of both cases (fixed hashcode or random hashcode for keys) will have same result and that is "unexpected behavior". The very basic need of hashcode in HashMap is to identify the bucket location where to put the key-value pair, and from where it has to be retrieved.

If the hashcode of key object changes every time, the exact location of key-value pair will be calculated different, every time. This way, one object stored in HashMap will be lost forever and there will be very minimum possibility to get it back from map.

For this same reason, key are suggested to be immutable, so that they return a unique and same hashcode each time requested on same key object.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q3. How to sort an ArrayList of objectsData Structure
Ans. Using Collections.sort()

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q4. What is the O notation for the ArrayList and List? And which one would you choose to insert item in the middle?Data Structure
 This question was recently asked at 'ExpertSoft'.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          Asked in 1 Companies


 Q5. What is Queue ?Data Structure
 This question was recently asked at 'Unisys'.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          Asked in 1 Companies


 Q6. Write an algorithm to shift a linked list n positions.Data Structure
 This question was recently asked at 'Amdocs'.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          Asked in 1 Companies


 Q7. What is the time complexity and space complexity of reversing a Linked List ?Data Structure
Ans. o(n) for time complexity
o(1) for space complexity

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q8. What is Message Queue or MQ ?Data Structure
Ans. Message queues implement an asynchronous communication pattern between two or more processes/threads whereby the sending and receiving party do not need to interact with the message queue at the same time. Messages placed onto the queue are stored until the recipient retrieves them. Message queues have implicit or explicit limits on the size of data that may be transmitted in a single message and the number of messages that may remain outstanding on the queue.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     message queue     Asked in 1 Companies


 Q9. Linked List related questions.Data Structure
 This question was recently asked at 'Compro Technologies'.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          Asked in 1 Companies


 Q10. How to build a blocking queue ?Data Structure
 This question was recently asked at 'Jefferies'.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          Asked in 1 Companies


 Q11. Implement a queue, using only stacksData Structure
 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 Companies


 Q12. Write a Program to print all nodes of the data structure ?Algorithm
 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 Companies


 Q13. Implement a Stack with 2 threads in which one thread push data and another pop data.Data Structure
 This question was recently asked at 'HCL Technologies'.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     stack     Asked in 1 Companies


 Q14. Detect a loop in a linked listData Structure
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 Companies


 Q15. Write a Program to Find the maximum sum of the sub array ?Data Structure
 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 Companies


 Q16. Write a program to insert a value after a specific value in an array.Data Structure
 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     


 Q17. Find the length of the non repeated numbers in an array.Data Structure
 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     


 Q18. Find number of recycled pairs in n array.Data Structure
 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     


 Q19. In an array every element is repeated twice except one, Find that element?Data Structure
 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     


 Q20. Difference between Arrays and LinkedList ?Data Structure
 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     arrays vs linkedlist


 Q21. Can you write code to copy one array into another ?Data Structure
 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     


 Q22. What is hashing ?data structure
Ans. Hashing is a technique to calculate the hash code for any object

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q23. Why does an array need continuous memory locations and not Linked List ?Data Structure
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     


 Q24. Why does an array index starts at 0 and not 1 ?Data Structure
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     


 Q25. How will you implement your own custom hashmap and linkedlist ?Data Structure
 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     


 Q26. What can we do if we need to retrieve Fibonacci value at a particular index faster ? Can we use Linked List ?Data Structure
 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 Companies


 Q27. Write a method that returns maximum depth of a tree ?Algorithm
 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 Companies


 Q28. What is the difference between pop and peek function of stack ?Data Structure
Ans. pop method pulls the top element from the stack and then move the top to the next element whereas peek only get the top element but doesn't move the top.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     stack


 Q29. Write a program to sort a stack in ascending order You should not make any assumptions about how the stack is implemented The following are the only functions that should be used to write this program: push | pop | peek | isEmptyAlgorithm
 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 Structures


 Q30. Describe how you could use a single array to implement three stacksAlgorithm
 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


next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: