Loading

Name several sort algorithms of an array, their working principles and their efficency.

Bubble sort (compare two elements and switch them if one of them is higher than other, depending on ordering preference), iterate over the whole array of elements. Efficency O(n2).

Insert sort, make a separate list, where you insert the elements in an ordered manner, that is start at the smallest element and go until an element that is bigger than the input or end of list and insert it before that. Efficency O(n2).

Selection sort, iterate over the whole array and find the smallest element, put it into start, then iterate from smallest +1, then smallest +2. Efficency O(n2).

Merge sort, split array into smaller arrays until size 1 is reached, then assume size 1 is sorted, then merge them while sorting, the sub arrays. Efficency O(n logn).

Quicksort. Select a pivot point, split all elements that are larger than that to one side, smaller to other, then put the pivot, where it belongs. After do it on smaller arrays, when all is done, the arrays are merged and the final array is sorted. Efficency O(n logn).  

Answered by Egidijus S. Computing tutor

1100 Views

See similar Computing IB tutors
Answered by Egidijus S.
Computing tutor

1100 Views

See similar Computing IB tutors
A pair of laptops with a tutor displayed on one and a student on the other. The student is raising his hand to answer the teacher's question.
Need help with Computing?

Have a Free Video Meeting with one of our friendly tutors.

A pair of laptops with a tutor displayed on one and a student on the other. The student is raising his hand to answer the teacher's question.
Need help with Computing?

Have a Free Video Meeting with one of our friendly tutors.

Related Computing IB answers

Add the binary numbers 100101 and 101001 and convert them to decimal (they are unsigned integers). What are possible issues when adding the numbers?

Answered by Egidijus S.

The program I've written doesn't do what its supposed to! I don't have any errors, so I don't even know where to start looking for the problem. Where can I begin?

Answered by Brendan C.

What is data validation and data verification?

Answered by Carlota O.

What is a network protocol and why do we need it?

Answered by Toma M.

A pair of laptops with a tutor displayed on one and a student on the other. The student is raising his hand to answer the teacher's question.
Need help with Computing?

Have a Free Video Meeting with one of our friendly tutors.