Sorting Definition and 79 Threads

  1. L

    How to Sort Word Frequencies in a C Program?

    Homework Statement Develop a C program that to count how many times each word appears in a large text file. Your program must read words from a file and output the number of times each word of the file appears. 1. Implement an algorithm to count how many times each word appears in a large...
  2. M

    Sorting from smallest to largest in C

    Homework Statement I have to create a program that will sort an array of structs with random numbers from smallest to largest. Homework Equations This is my code right now. #include <stdio.h> #include <stdlib.h> #include <time.h> typedef struct { int a; int b; } pie...
  3. V

    Exploring Perfect Sorting Algorithms

    Is quick sort the most efficient algorithm or there is a possibility of a perfect sorting algorithm to be discovered?
  4. P

    Sorting Algorithm to Rearrange Zeros at End - Help Needed

    I just wrote a big long post on this algorithm I'm working on to solve the determinant of an nxn matrix, but I got booted before I could post so it's all gone! I'm brand new to this forum. As I was writing, I solved most of the problem, but I'm still stuck with a sorting algorithm that I...
  5. N

    Sorting 3 Numbers and Even/Odd Questions

    hello everyone i want your expert and your help please i have to write a program that takes three numbers as input and write them in ascending order. Sample Program Run: Enter three numbers: 4 8 3 Numbers in ascending order: 3 4 8 how can i do it ?!:cry: and i want to ask you...
  6. W

    Sorting Algorithms and Their Run Times

    Homework Statement hi, I was asked to notice a pattern involving the run times of sorting algorithms.. however, the run time timer program I have keeps giving me different values for the same length lists :| will the pattern/formula be an approximation then? also, I read that the run time...
  7. L

    Sorting Strings with int Sort: Explained + Tips

    Hi there PF. For this problem I need to take the following code which apparently sorts an array with integers, and sort strings instead. However I DO NOT understand how this works for integers, much less how I could make it work for strings. Could someone please explain it to me? A few tips to...
  8. F

    Solve Equation: x = tB + (1-t)A

    Can anyone help me rearrange this equation so that t is isolated please, it's driving me nuts. x = tB + (1 - t)A all I can seem to do so far is isolate one of the t's... 1... x - (1-t)A = tB 2... x - (1-t)A ---------- = t B
  9. K

    Sorting Pages in QuarkXPress: A Constrained Approach

    Hi I have a sorting problem I haven't been able to solve and was hoping someone here could lend some insights. The basic problem is resorting pages in a page layout application (QuarkXPress) where I'm constrained to only the functions Quark supplies for moving pages around in a document...
  10. F

    The asymptotic lower bound for sorting n elements is n*log(n)

    the asymptotic lower bound for sorting n elements is n*log(n). what about sorting a set of n elements when you know that they only take on k distinct values? does n*log(k) sound right?
  11. I

    MATLAB Sorting a jumbled face uding Matlab

    I am developing a MATLAB code for the problem. I have a idea but would like to improve it and therefore would want to ask for opinions. We are given a jumbled up image of a human face. We have to arrange the face back into place. We will be shown and given the randomized image. The...
  12. C

    Can You Organize Files with Tags and Metadata?

    I was wondering if there was any good software 'out there' for organizing files with some kind of tags or metadata. For example, a file might be tagged "additive number theory" and "combinatorics" and might have a title, author, and year as metadata. Ideally all could be searched and a list of...
  13. N

    MATLAB Help with MATLAB, creating a sorting function

    This is what I had originally function out = msort(x) %This function helps sort numbers in ascending and descending order. %To put in descending order, user must include 'd' in the input. y = length(x); sorted = 0; n = 0; while ~sorted sorted = 1; for i = 1:y-1...
  14. B

    Speed up Sorts with 2 New Techniques: Sort-Lenses & Prefab-Sorts

    A few new techniques exist to speed up sorts. Here are two. (1) When sorting large strings and many of them it is better to use a sort-lens. A sort-lens is an integer array indexing the source data. string data [n] int sort_lens[n] The data is referenced by: data[sort_lens[COUNTER]] ...
  15. J

    Sorting Objects into Percentile Groups

    Hello, Is there a well known method (algorithm, process, etc.) by which objects are sorted into percentile groups based on some aspect of the object such as weight or size?
  16. S

    Infinite Loop problem in an array sorting program

    Hi, I am writing a function that takes in a real data array and a key partition value, which will rearrange the array so that elements with a lower value than x are placed before the elements with values >= the partition value. It then returns the index of the last element of the array with a...
  17. L

    Comp Sci Why Does My Java MergeSort Throw IndexOutOfBoundsException with Three Students?

    I wrote a class to sort Comparable elements in a list (ArrayList) I have Student class that contains lastName, firstName, studentID, and tuitionFee as its instance variables. At first I used mergeSort algorithm to write the Sorts class. It works when I add 1 student, still works with 2...
  18. rcgldr

    Efficient Merge Sort for External Storage Optimization

    Moderator note: This was split from https://www.physicsforums.com/showthread.php?p=1409789#post1409789 Perhaps this response should go into it's own thread regarding sorting ... yes. I think you mean sorts that use very little storage overhead. A merge sort typically doubles the required...
  19. MathematicalPhysicist

    Sorting a list of zeros and ones.

    Assume i have an initial list of n-2 columns and 2^(n-2) rows, where initially: all the entries are zero. i wnt to sort it out that eveantually we'll get a truth table for this. i.e if we have n-2=2 rows and 4 columns, then: 0 0 1 0 0 1 1 1 obvously we have here a jump first we...
  20. P

    Java How can I add an integer to a sorted array using binary search in Java?

    Hello, I need to write a method that adds an interger to a sorted array of integers. I'm using the following code to search for an interger in the array private static int binarySearch(int[] list, int key, int low, int high) { while (low <=...
  21. z-component

    C/C++ Solving a C++ Problem: Sorting Last Names in Alphabetical Order

    [SOLVED] C++ problem I'm trying to make a structure of 4 elements to store an array of items. I'm trying to sort the lastName element in alphabetical, ascending order, but I keep getting errors around the last for loop. Can someone tell me what I'm doing wrong? #include "stdafx.h"...
  22. K

    How Can I Correctly Sort and Output Arrays from a Single File in C++?

    The Problem (from the handout, word for word): Write a program that reads a list of integers from the file "numbers.in" into an array, which I will call numbers. Then sort the numbers into 3 groups, a group of odd numbers, a group of even numbers, and a group of negative numbers, use an array...
  23. M

    Request for Frequently Asked Question Sticky Sorting

    i once posted askign if a frequently asked question sticky could be sorted. i think i'd like to restate that request following bs's two threads a quick search of "recurring" finds around 7 threads obviously starting with the question 'is 0.9 recurring one?' the second yet again involved...
  24. B

    Java Selection Sorting Arrays in Java

    So, I have to create a program that makes a new array with 20 slots, then it asks you to enter a value into each index, which I have here: import java.io.*; class ArrayLoop { public static void main (String[] args) throws IOException { int[] array = new int[20]; for (int i...
  25. C

    Sorting Products by Weight - Need Advice

    I have a problem that I need some help on. I have some product that I need to separate by weight Product 1 is 15 grams Product 2 is 22 grams Product 3 is 28 grams Could I use a conveyor to get these 3 items up to 21 MPH, have them shoot off the end on the conveyor, and have them sort...
  26. D

    Sock Sorting: A Blind Man's Challenge

    blind man+ new prob :) 2 blind man each holding 3 pairs of newly bought socks of different colours (red, green ,blue). They bumped into each other and the socks fell to the ground. Find a way to help they get their socks back. as in a pair of each colour. :smile:
  27. D

    Why is my mergesort function only working for arrays up to three items?

    I'm not sure that this post belongs here, but I'll give it a try. I'm having a devil of a time :devil: trying to figure out why my program won't work. The assignment was to create and array class consisting of: A constructor that takes and integer for the size of the array A constructor...
  28. P

    Exploring Sorting Techniques and Time Complexities: A Comprehensive Guide

    Would you please tell me how many a sorting technique you have implemented or you have heard of ? And if you don't care, please also give me some information about time complexities of the algorithms you mention... Thank you very much,
  29. A

    Optimize Windows QuickLaunch Sorting | Organize Your QuickLaunch Bar Efficiently

    Hey guys, you know the Windows QuickLaunch bar? It's the little thing by the Start Button. For some reason on my WinXP system it would not maintain the order that I sorted them by (I like my Firefox, then Show Desktop, mp3 folder, then WinAmp). I'd sort them, but upon each reboot they would...
Back
Top