<< Prev Showing: 96-100 of 353 Next >>
· 71-75 · 76-80 · 81-85 · 86-90 · 91-95 · 96-100 · 101-105 · 106-110 · 111-115 · 116-120 · 121-125 ·Merging Sorted Lists using Heaps
I need help figuring out an algorithm that will merge k sorted lists into one sorted lists in O(n lg k) time where n is the number of elements in ALL the input lists. I believe we are supposed to use a Heap for k-way merging.
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
70665
OTA ID:
105035
Attached is a problem asking if radix sort would be appropriate. I think it would not be appropriate. Can you help give me reasons why? One of the reasons why I think radix sort is not better then the other is because radix is linear, and the other one is n log n (which I believe is faster?).
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
70777
OTA ID:
102804
sorting an array of integers in linear time
How can I sort an array of integers in O(n) time, where different integers may have different numbers of digits, but the total number of digits over ALL the integers in the array is n? My assumption is that radix sort is somehow involved.
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
70840
OTA ID:
102804
The solution seems to be the the following, but I need a more in-depth explanation, particularly on why we should use merge sort and binary sort. Here is the problem at a high level (you can look at the attachment for more detail): Describe a (n log_2 n) time algorithm that, given a set S of n real numbers and another real number x, determines whether or not there exist two elements in S whose sum is exactly x. Solution: Sort the array using an algorithm of order O(n log n) (You can use mergesort but you cannot use quicksort) Then for every element y in the array binary search the sorted array for x - y O(n log n) + O(n log n) = O(n log n)
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
70941
OTA ID:
102804
Min heap problem: merge k sorted lists into one sorted list in O(n lg k) time
Recall this problem -- define an algorithm that will merge k sorted lists into one sorted lists in O(n lg k) time where n is the number of elements in ALL the input lists... My question is why do we define a comparison that states the following: "We shall also need to define comparison with empty lists, and so we define it taking that any non-empty list is smaller than the empty list." when we already established this: "Now let us take our k sorted lists (of arbitrary lengths) and define the comparison between the lists by their smallest elements."
Subject:
Computer Science
Topic:
Data Structures and Algorithms
Posting ID:
71110
OTA ID:
105035
<< Prev Showing: 96-100 of 353 Next >>
· 1-5 · 6-10 · 11-15 · 16-20 · 21-25 · 26-30 · 31-35 · 36-40 · 41-45 · 46-50 · 51-55 · 56-60 · 61-65 · 66-70 · 71-75 · 76-80 · 81-85 · 86-90 · 91-95 · 96-100 · 101-105 · 106-110 · 111-115 · 116-120 · 121-125 · 126-130 · 131-135 · 136-140 · 141-145 · 146-150 · 151-155 · 156-160 · 161-165 · 166-170 · 171-175 · 176-180 · 181-185 · 186-190 · 191-195 · 196-200 · 201-205 · 206-210 · 211-215 · 216-220 · 221-225 · 226-230 · 231-235 · 236-240 · 241-245 · 246-250 · 251-255 · 256-260 · 261-265 · 266-270 · 271-275 · 276-280 · 281-285 · 286-290 · 291-295 · 296-300 · 301-305 · 306-310 · 311-315 · 316-320 · 321-325 · 326-330 · 331-335 · 336-340 · 341-345 · 346-350 · 351-353 ·Page generated in 0.0956 seconds