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...
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...
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...
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...
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...
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...
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
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...
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?
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...
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...
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...
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]] ...
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?
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...
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...
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...
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...
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 <=...
[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"...
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...
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...
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...
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...
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:
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...
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,
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...