We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You don't have to. Use a binary tree. For each item you put in the tree, the number of shifts increments by the number of items in the tree that are greater than it. Much easier to implement than a sort.
Insertion Sort Advanced Analysis
You are viewing a single comment's thread. Return to all comments →
You don't have to. Use a binary tree. For each item you put in the tree, the number of shifts increments by the number of items in the tree that are greater than it. Much easier to implement than a sort.