Algorithm - Interview Questions and Answers for 'General electric' | 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

   



Algorithm - Interview Questions and Answers for 'General electric' - 1 question(s) found - Order By Newest

 Q1. How to create list that will sort it's elements dynamically?Algorithm
Ans. Override the behavior of collection class to sort the list upon each element addition. Though it's not recommended as list are sorting heavy data structures.

List<MyType> list = new ArrayList<MyType>() {
public boolean add(MyType mt) {
super.add(mt);
Collections.sort(list, comparator);
return true;
}
};

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

   Like         Discuss         Correct / Improve          Asked in 1 Companies      intermediate


Related Questions

  Can you provide some implementation of a Dictionary having large number of words ?
 In a Linked list with sorted numbers, insert a new numbers while maintaining the sort order.
 What is the difference between Graph's Breadth first and Depth First algorithm ?
  What are the pre-requisite for the collection to perform Binary Search ?
 Explain various Searching and Sorting Algorithms ?
 Write a program for LinkedList, with method to append node and traversing the list ?
  Which sorting algorithm is used by Collections.sort() in Java ?
  How to determine if the linked list has a cycle in it ?
 Write an Algorithm for Graph Traversal ? The Graph has a loop.
 Write an algorithm / java program for Heap Sort ?



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: