I am working on a merge sort of two files of integers, and am fuzzy on some of the logic\syntax. I need two threads, each of which will open a file, read its contents into an array, and then sort the array using qsort. One thread will operate on file f1.dat(10000 numbers) and leave its sorted contents in array x, while the other will use file f2.dat(11999 numbers) and array y. When the threads have finished, I need to merge x and y into array z so that z is also sorted. Also, I am wanting to use one function for both threads, passing the array, its size, and the name of the file in a structure.
Currently, I have a struct set up with the arrays, their sizes, and the name of the two files, a comparison function for qsort, a sort function for the contents of the files, a merge sort for the z array, and of course the creation of the threads.
I think the biggest area I have questions about is how to properly pass a structure to a generalized sort function and then sort data using that structure parameter.
Hi All,
I have 4 files in below format. I took them as an example.
File 1: Cut from position 1-4 then 6-7 then 8-14 then rest left and make them as columns in one new file. Inserting character H to the initial of all line like HCTOT.
CTOT 456787897 Low fever
CTOR 556712345 High fever... (2 Replies)
I have a single threaded bash script that I am using to create secgroup rules in openstack. The process to add the rules is taking forever. Any of you python gurus know how to convert this bash script into a thread python script? Thanks in advanced.
create-secgroup-rules.sh:
#!/bin/bash
cat ... (2 Replies)
Hi friends,
I have implemented the merge sort algorith in c, before I put forward my question, you please have a look at my code.
// The array is sorted, as 1234
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int A = {4, 3, 2, 1};
void Merge_Sort(int , int, int);
void... (0 Replies)
Hi, this is about sorting a very large file (like 10 gb) to keep lines with unique entries across SOME of the columns.
The line originally looked like this:
sort -u -k2,2 -k3,3n -k4,4n -k5,5n -k6,6n file_unsorted > file_sorted
please note the -u flag.
The problem is that this single... (4 Replies)
hi all,
i have three files naming file1 , file2, file3 .
i want to merge the content of these three files, sort them and display the sorted output on the screen page by page. (1 Reply)
hello,
in my free time i am writing on a c++ mud codebase, a while ago i decided that i would move to pthreads, so i could make use of smp. now i have a problem which i just cant fix - for weeks now. i have a main thread which spawns my threads, as soon as spawned they get a pthread_cond_wait, so... (4 Replies)
I need to modify my version of find in unix and get it to create and use two POSIX threads to carry out concurrent finding operations.
How do i get about doing this>?
If anyone could help me it would be much appreciated.
Thanx
Mariuca (1 Reply)
Dear All,
I run a website for a non-profit. Does anyone know where I can get free or cheap software to run threaded discussions for our website?
Our website is obviously running off a unix platform.
Thanks (4 Replies)