106 questions
2
votes
0
answers
43
views
Issue with MPI Parallel CSV Processing: Only Partial Entries Written to Output File
I am working on a parallel sorting program using MPI to sort a large CSV file (35 GB, 1 billion lines). However, I am first testing the program with a smaller file, and I am encountering an issue ...
1
vote
2
answers
461
views
Issue with Bucket Sort Implementation in Python
I'm trying to implement the bucket sort algorithm using Python. My current implementation seems to have a problem when dealing with integer values outside the range of 0 to 1. Specifically, the index ...
1
vote
0
answers
64
views
Iteration failure in radixsort aka bucket sort algorithm,Radix sort inefficient because it assigns wrong size for bucket 0 according to the unit test
For one of my assignment, I am asked to implement a radix sort algorithm. Here is the code that was written so far:
class RadixSort:
def __init__(self):
self.base = 7
self....
-1
votes
1
answer
452
views
Bucket Sort for normal distribution
I wanted to program bucket sort for a normal distribution (instead of the uniform distributed generally assumed by bucket sort). When I looked into the math, I came up with the following:
def ...
0
votes
0
answers
56
views
How to pass arguments in pthread_create() in c [duplicate]
I want to implement bucket sort with multi-threading. So I create an array and separate it into several subsequence, the subsequence is then passed to the pthread_create() by passing the starting ...
0
votes
0
answers
83
views
How can I make this version of Bucket Sort using recursion?
Currently what this function is doing is sorting an array using BucketSort. The array is going to be with numbers between 0 and 999. However instead of that I want to split every bucket into 10 other ...
-2
votes
1
answer
133
views
Bucket sort: Why all values end up in the first bucket?
import random
random.seed(0)
def bucket_sort(mylist):
# initialize the buckets
lst = []
for i in range(10):
lst.append([])
print(lst)
length = len(mylist)
...
2
votes
3
answers
2k
views
Bucket sort or merge sort?
I am doing an c++ assignment where I have to sort data (n=400) which is student scores from 0-100. I am confused on using bucket sort, which sorts algorithm into buckets or merge sort, which divides ...
1
vote
0
answers
97
views
I can't seem to to find the time complexity of Histogram sort anywhere? I am aware it is type of bucket sort but what is the exact time complexity?
This is one implementation of a histogram. If you anybody has other examples and can explain the time complexity of histogram sort w.r.t that, it can also help.
Refer https://www.geeksforgeeks.org/...
0
votes
1
answer
326
views
Merging 1000s of files into one sorted file with memory constraints - heap vs bucket sort
The numbers are unique within each file and across all files. Here is one popular approach (external sorting) to merge n files into one sorted file when our compute machine cannot store all the data:
...
0
votes
0
answers
452
views
How to use bucket sort with strings in Python?
I'm tasked with generating a few unsorted keys that will then be sorted alphabetically for example
["dba321db32d1", "abc123ab12a1". "abd456ab45a4"] will then be output as ...
-1
votes
2
answers
359
views
Sorting an array using Bucket Sort [duplicate]
I want to sort this array = {20, 46, 22, 19, 6, 42, 14, 5, 48, 47, 17, 39, 51, 7, 2} using bucket sort. I get a arrayindexoutofboundsexception error in my code. Can someone please help me to correct ...
0
votes
1
answer
461
views
Why is Time Complexity of Bucket Sort is O(n^2) and not O(log(n) * n^2)?
import math
def insertionSort(arr):
for i in range(len(arr)-1):
for j in range(i+1, len(arr)):
if arr[j] < arr[i]:
arr[j], arr[i] = arr[i], arr[j]
...
0
votes
2
answers
2k
views
Top K Frequent Elements - time complexity: Bucket Sort vs Heap
I was working on a leetcode problem (https://leetcode.com/problems/top-k-frequent-elements/) which is:
Given an integer array nums and an integer k, return the k most frequent elements. You may ...
0
votes
1
answer
342
views
Sorting an array using Bucket Sort in C. Question about how the code to insert new elements in the linked list works
I am coding a program in C that sorts an array by using bucketSort. My code works. I can print the data structure and every element of the original array is in the right "bucket". I ...