Data Structures & AlgorithmsEasyTCS NQT · Infosys pattern
Which of these sorting algorithms is stable in its standard implementation?
- A. Quick sort
- B. Selection sort
- C. Heap sort
- D. Merge sort
Correct answer: D. Merge sort
Standard merge sort takes from the left half on ties, so equal keys keep their order. Quick sort, heap sort and selection sort can all swap equal keys past each other over long distances.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the time complexity of inserting a new node at the head of a singly linked list of n nodes?
- With a good hash function and a bounded load factor, what is the average time to search for a key in a hash table?
- What is the postfix form of the infix expression A + B C?
- What is the value of the postfix expression 6 2 3 + − 3 8 2 / + ?
- A circular queue is implemented in an array of size 10 and one slot is always kept empty so that 'full' and 'empty' can be told apart. How…
- Keys 23, 43, 13 and 27 are inserted in that order into an empty hash table of size 10 with h(k) = k mod 10 and linear probing. At which…