What is Sorting: Definition and 79 Discussions

Sorting is any process of arranging items systematically, and has two common, yet distinct meanings:

ordering: arranging items in a sequence ordered by some criterion;
categorizing: grouping items with similar properties.Ordering items is the combination of categorizing them based on equivalent order, and ordering the categories themselves.

View More On Wikipedia.org
  1. DaveC426913

    Unexpected behavior in Excel when sorting

    I'm trying to sort this sheet in Excel. I want to sort it on Column D. I select the entire page by clicking the black arrow in the upper left corner: Now I Data > Sort which brings up a dialogue where I specify the column I want to sort by : (I can already tell there may be a problem -...
  2. T

    DeepMind AI Develops Efficient Sorting Algorithms

  3. logical3902490

    Sorting an Array of 2-D Records

    I've just started learning sorting algorithms on arrays of records and wanted to ensure I'm not doing it wrong so I have a basic question. I am sorting an array of records, where the records have two components, A and B. For example a record (3,2) has an A value of 3 and a B value of 2. The...
  4. R

    Comparing sorting algorithms -- Insertion Sort vs. Merge Sort

    The answer says insertion sort runs faster when we're sorting less than 43 items. I agree but with the condition that the first item will not be faster. Why does the answer not mention this? Is it because it is insignificantly faster?
  5. T

    Entropy in the Brazil Nut Sorting Effect

    In Brazil Nut effect /Granular convection the large grains move upward and the smaller ones go downward. This sorting is supposed to reduce the multiplicity of this system. But according to the second law of thermodynamics, entropy and multiplicity of the system should increase. I am looking...
  6. T

    New Nearest Neighbor & Sorting approach

    Finding the Nearest Neighbor in a dataset has always been considered difficult, needing data-specific coding. Now some researchers, trying to prove there is no universal approach, say they have found one. This first link is to the 'popular' article...
  7. SSequence

    Can Sorting Ever Be Done in Time Proportional to n?

    The question(s) here can be asked for many problems (and not just sorting). Let's consider the standard case of sorting an array of size ##n## containing numbers. If we consider a naive algorithm, its time would be proportional to ##n^2##. For example, the naive algorithm could be proceed with...
  8. E

    Generic QuickSort causing StackOverflow?

    I have to sort an array in increasing order based on the compareTo method. I'm not allowed to use the Arrays, Collections, Set, or Map classes. Here's my code: public static <T extends Comparable<? super T>> void sort (T[] arr) { // If arr is null, empty, // or only has...
  9. E

    Java Recursively sorting an array of strings w/o aux. parameter

    One of my professor's assignments is proving particularly tricky for me. It reads: "Write the method public static void sort(String[] a) that sorts the array a in increasing order. The method must be a short recursive program. Do not use quicksort or merge sort. It should be a lot...
  10. rcgldr

    Sorting Revisited #3: Linked List Merge Sort

    Links to prior threads https://www.physicsforums.com/threads/sorting-revisited-again.728448 https://www.physicsforums.com/threads/sorting-revisited.218369 https://www.physicsforums.com/threads/efficient-sorting.181589 https://www.physicsforums.com/threads/merge-sort-using-linked-indexes.786487...
  11. TheMathNoob

    Why does this sorting algorithm properly sort the array?

    Homework Statement Consider the following sorting algorithm for an array of numbers (Assume the size n of the array is divisible by 3): • Sort the initial 2/3 of the array. • Sort the final 2/3 and then again the initial 2/3. Reason that this algorithm properly sorts the array. What is its...
  12. Borek

    Sorting by moving groups of numbers

    It all starts with a shuffling. We have a sorted list, we take out groups of numbers and we insert them in random positions: Then, it is about sorting the numbers back using the same approach, in a minimum numbers of steps (which doesn't have to be identical to a number of steps taken during...
  13. G

    C: Sorting and searching data from separated files

    Homework Statement Write a program that reads data from binary file EMPLOYEE.DAT (employees are proffesors and teaching assistants, assume that the file exists). Split data about proffesors and teaching assistants in two separate text files and sort data by ID using insertion sort algorithm...
  14. S

    Is this considered a valid sorting algorithm?

    Let me know if I've invented a valid O(n) sorting algorithm. public void Sort ( this List<T> L ) { // Check every second whether L is sorted // Given enough time, natural bit flips will eventually make L sorted while ( !L.IsSorted() ) Thread.Sleep(1000); } public bool IsSorted (...
  15. M

    Tips for sorting conferences in CV

    I am a freshly graduated engineering student and am currently writing my first CV. At the end of my studies I attended one conference as a research paper author and another one as a guest lecturer on the same topic as the previous conference. I suppose both are important to be included in a CV...
  16. D

    Sorting/shuffling machine for trading cards (sports, Magic+)

    I work with a company that buys and sells millions of trading cards every year but the majority of these are sold for fractions of a penny if they're sold at all. From what I can see there are two options for this company to get more out of these cards, both of which are incredibly...
  17. T

    Comp Sci How to Save and Sort a List of Historical Events in Java?

    Homework Statement You are provided the following list that contains (semi-random) years from modern history. Save the list to a text file named “events.txt” Write a program that: 1. Reads in the file “events.txt” 2. Sorts it with the latest events first 3. Determines whether the founding of...
  18. M

    MHB Sorting with RADIX & COUNTING: How to?

    Hey! :o I have to describe the operation of the processure "RADIX SORT" at the following list of words: COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX When I want to show the work of the algorithm RADIX SORT do I have to sort the letters by comparing them or...
  19. S

    Can Physics Optimize the Storage of L Beams in a Confined Space?

    Hi What is the most efficient way to theoretically store an L beam in a given area, the more beams in that area the better, obvioustly this can't be done in real life but with a physics engine could maybe be calculated? Note: Each beam can be at any rotation or any axis. The area is 21.06 cm...
  20. Henry R

    MHB Selection Sort & Insertion Sort: Step-by-Step Guide to Sorting Data

    How to do this? Show the step by step how the following data is sorted into ascending order using the given sorting algorithm : 22 85 43 28 65 35 i) Selection sort. ii) Insertion Sort.
  21. evinda

    MHB Sorting $m$ Integers in $O(m)$ Time

    Hello! (Smile) How could we show that we can sort $m$ integers with values between $0$ and $m^2-1$ in $O(m)$ time? (Thinking)
  22. M

    MHB Sorting $8$ Players in $24$ Hours: Is it Possible?

    Hey! :o We have $8$ players and we want to sort them in $24$ hours. There is one stadium. Each game lasts one hour. In how many hours can we sort them?? (Wondering) I thought that we could it as followed: $$\boxed{P1} \ \boxed{P2} \ \boxed{P3} \ \boxed{P4} \ \boxed{P5} \ \boxed{P6} \...
  23. H

    Comp Sci Problems With Sorting A Linked List In Java

    Homework Statement Create a SortedLinkedList class which implements the LinkedListInterface. Remember to use the Comparable class Basically, I need to implement a sorted linked list that uses generics and uses compareTo to sort objects. I need it to be able to sort names...
  24. rcgldr

    How does radix sort perform on partially sorted data?

    Added radix sort to sort examples in: http://rcgldr.net/misc/sortv.zip Results on my system: Time to sort 4,194,304 64 bit elements of psuedo random data: radix sort rsortv.cpp 203 ms hybrid (radix+merge) sort hsortv.cpp 265 ms merge sort...
  25. A

    How are there so many sorting algorithms?

    I was looking through the list of sorting algorithms and there are so many of them! A simple problem where each element is less that or greater than the next term has so many solutions. How is that? My question is a rhetorical one but is there any limit to number of different techniques for...
  26. S

    Programs Sorting my life out and getting my degree

    I'm not going to give you guys the full story, but I will summarise. A fair few years ago, I got into some trouble, starting drinking far too much and basically went of the rails. I got kicked out of uni, ended up going to prison for a little bit, almost died after being stabbed and got into a...
  27. C

    Protein Sorting: ER or Mitochondria?

    Homework Statement A protein contains both an N-terminal mitochondrial matrix targeting sequence and an internal ER start transfer sequence. Where do you think this protein goes? The Attempt at a Solution I've been told that it would still go to the ER. I know that when the ER...
  28. S

    Sorting Nuclear Reactors: Exploring Particle Manipulation

    Is there any manipulation of nuclear particle to sort out the nuclear reactor?
  29. K

    Automatic sorting with barcode identification inside a refrigerator

    I'm endeavoring to prototype a challenging sorting mechanism inside a fridge and would appreciate any tips on how to get from the specs to a plausible design. #Problem The aim of the game is to identify and sort food items in the limited space of a fridge - such that a user would push...
  30. T

    Comp Sci Sorting array into ascending order in C++

    Homework Statement a. Define an array with a maximum of 20 integers values, and fill the array with numbers input from the keyboard or assigned by the program. Then write a function named split() that reads the array and places all zeros or positive...
  31. D

    Integrals and Convolution: How to Group Multiple Functions Together?

    Hi, I shall show the following: (f*g) \star (f*g) = (f\star f)*(g\star g) where * denotes convolution and \star cross-correlation. Writing this in terms of integral & regrouping: \int_{\phi} \left(\int_{\tau_1} f(t - \tau_1) g(\tau_1) d\tau_1\right) \cdot \left(\int_{\tau_2} f(\tau_2)...
  32. D

    Sorting Fractions: Does Adding 1 to the Denominator Affect Order?

    Hello friends, I am attempting to solve this problem for a sorting algorithm with a lot of elements in fraction form (I'm avoiding floating point operations). My question is: Given a sequence of increasing fractions, does adding 1 to the denominator affect the ordering of th sequence...
  33. X

    Java Java. Searching and sorting a stack

    I'm trying a practice problem from the book. It's 10 books with title, ISBN, and year. The input needs to be sorted by year and it needs to let you search for a book title. class LinkedStack { /** The Node class is used to implement the linked list. */...
  34. M

    Engineering ball sorting project, static electricity

    Hello all, I am an engineering student currently undertaking a project at univeristy. It involves the sorting of 4 different balls of which I have deduced how to sort 2 of them leaving just 2 types of balls to sort... The remaining two are of identical size, 10mm in radius, and are...
  35. M

    Sorting Algorithm Performance - Interview-Based Problem

    Hi guys, My professor recently asked a challenging question - he says it's been asked on an interview and he wanted to pose it as a homework. Attached is the graph of sorting algorithm performance. The interviewer asks: "Tell me everything you can about this algorithm just by looking at...
  36. S

    Comp Sci Linked list sorting method in java

    Homework Statement I need to write a sorting method for my IntNode class. this is supposed to use the selection sort algorithm. Homework Equations selection sort algorithm given by problem while(the first list still has some nodes { 1. find the node with the largest element of...
  37. C

    Sorting Lattice Energies: KF, MgS, RbI

    Homework Statement Place the following in order of decreasing magnitude of lattice energy. KF, MgS, RbI I'm not really sure how to do this without looking up the lattice energy values with each. And I don't think that is what our teacher wants us to do
  38. A

    Automotive What are the key differences between Mopar and Ford V-8 engines?

    being a Mopar person and enjoying the simplicity of their engine lineup many times I've listened to a Ford person and walked away shaking my head. Mopar small blocks: 318 and 340. 273 was early and went bye-bye. 360 was smog 340. Mopar big blocks: 383 and 440. Hemi was heads stuck on 440. there...
  39. J

    Mathematica [Mathematica] Sorting polynomial terms

    Hi. Can someone explain to me how to sort a Series so that the terms are in increasing powers of the exponent? For example the code: myseries = Normal[ Series[Sqrt[1 - w], {w, 0, 5}]] /. w -> 1/z produces 1-\frac{7}{256 z^5}-\frac{5}{128 z^4}-\frac{1}{16 z^3}-\frac{1}{8 z^2}-\frac{1}{2...
  40. M

    File input and output, sorting issues

    Homework Statement I think it runs up to the couts I have in my input function but then it just crashes. I'm running it on DevC++. The code is in [b]3 along with the assignment link. It's assignment 11 that I'm working on and the text file is next to the link for the assignment. I would...
  41. N

    Merge Sorting 3 Lists of Similar Size

    1. Implement a new version of mergeSort() where 3 sorted lists (instead of 2) of about the same size are merged. 2. No equations 3. here is what i have so far: public final class Sort { /** * Simple insertion sort. * @param a an array of Comparable items...
  42. M

    Sorting 2d array with qsort, keeping rows in order (C)

    I have been trying to get qsort to sort the rows of a 2d array I read in from a data file, and I have not been having much success to get it to do what I want. My array is a 4xarraysize array, where arraysize is the number of columns read in from a data file, with four entrees per row. I...
  43. B

    Strange glitches in my C sorting program

    Homework Statement I have to write a program that takes in a file that looks like this: 3424: 313 4334: 543 etc. and sorts the numbers on the write. Everything for getting the file into an array was done for me so I know it's correct. I'm having two strange problems. First, whenever I'm...
  44. M

    Directed acyclic graph profit sorting

    Suppose we have a directed acyclic graph. The nodes are labeled with integers (which may be negative). Imagine that the labels represent payoffs or costs of taking an action associated with each node. In order to perform an action you must perform prerequisite actions indicated by the graph...
  45. Z

    Need help with sorting a Python dictionary.

    Homework Statement Hi there, I need to sort a Python dictionary based on its values which are ints, then return the ordered list as the keys. I am thinking to make the inverse of the dictionary, take values and sort, then map back with the inverse dictionary. The problem is that...
  46. G

    Sorting sample from exponential

    What is the function that I get when I take a large sample from an exponential distribution (many values from the same distribution) and sort the sample points. I'm a bit surprised it's not really exponential. The shape seems to fit some data I have nicely, but I don't know the function to fit...
  47. M

    Mathematica Mathematica - sorting NSolve solutions

    Hello, everyone. I have a code written in Mathematica that loads a single file in turn. Each file contains a 200×2 array of numbers which are x,y coordinates of points. I feed each line of each file in a loop that contains a NSolve equation system. The equation system returns 5 outputs for...
  48. O

    Sorting Different Materials Balls By Weight: Most Efficient Method

    I have 5 different types of balls made out of different materials, all similar but not identical in weight, and all of the the same size. What is the best mechanism to sort these by weight? I can use any mechanical device to sort these balls, such as seesaws, etc. What is the most efficient way?
  49. S

    Solve Sorting Technique Problem with 4 Elementary Sorts

    Hello I'm having problem in solving this question with c/c++ code , please help me ? An eccentric doctor visits his patients in order of decreasing age. Patients entering the waiting list specify not only their names but also their ages. Each time the doctor wants to visit a patient, the...
  50. N

    Sorting Fresh & Boiled Eggs with an Inclined Plane

    Homework Statement here i am going to sort out fresh and hard boil egg. i suggested that used incline plane. It is expected that the boil egg will pass through the second positive gradient incline while the fresh egg are not. Homework Equations so my question is, what the equation involve...