algorithm 2 « Sort « Java Collection Q&A

Home
Java Collection Q&A
1.algorithm
2.array
3.Array Byte
4.Array Char
5.Array Convert
6.Array Dimension
7.Array Integer
8.Array Object
9.Array String
10.ArrayList
11.collection
12.comparator
13.Development
14.Garbage Collection
15.Generic
16.hash
17.HashMap
18.HashTable
19.iterator
20.LinkedList
21.List
22.Map
23.queue
24.Set
25.Sort
26.tree
Java Collection Q&A » Sort » algorithm 2 

1. best sorting algorithm    forums.oracle.com

2. Sorting Algorithms Counting Comparisons & Assignments...    forums.oracle.com

Hey there. I do not want you to do my homework for me. Now that that is out of the way, does this seem reasonable for a basic bubble sort of 1,000 random integers: 251,630 Comparisons and 754,890 Assignments? I do know what assignments & comparisons are, and I do have counters in the code I am using, BUT my book ...

3. Sort algorithm interface    forums.oracle.com

4. Would this sorting algorithm work?    forums.oracle.com

I'm writing a sorting algorithm for a class that implements the Comparable interface. The class (called Memo) has a field, 'entryDate' of type 'Date', which itself has int fields for day, month, and year. I want to have the class sorted by date, earliest to latest, and then (for entries on the same day) by 'priority' (a field of type int; ...

5. Merge Sort Algorithm    forums.oracle.com

If you're using ArrayList (like I did) for the dividing, don't use remove(0) to shave the first item off after you're done with it in the loop(s) like the pseudocode seems to suggest because that causes all the indexes to shift. I cut a full 2 seconds off (down to 0 seconds) of a 75k word list sort by using ints ...

6. Balanced Two way sort merge!Algorithm    forums.oracle.com

7. Collections with no sorting algorithm    forums.oracle.com

8. Sorting a String array - Algorithm    forums.oracle.com

9. Selection Sort Algorithm    forums.oracle.com

selection sort is an n^2 algorithm so that's how many iterations you should have. (i think) and btw: that looks like a selection sort algorithm to me, but you don't need the boolean variable in there. Edited by: art on Nov 7, 2007 3:48 AM Edited by: art on Nov 7, 2007 3:52 AM

10. a couple of problems with my sorting algorithms.    forums.oracle.com

It might all work much better and less fuzzy if you had Scholar instances that have firstName and lastName and other attributes, and different Comparator implementations for comparing different attributes. Java's an OO language, you know. Anyway, did you consider adding some System.out.printlns to your comparte-methods to see what the actual data is they operate on? Garbage in, garbage out...

11. Sorting Algorithm    forums.oracle.com

Few thoughts after a quick look: 1) Isn't mergesort a recursive algorithm? I dont see any recursive calls in merge(...)? 2) Why not simply alter the arry-array and not return it (i.e. void merge(...))? 3) The for loop appears to be of no use since it is only entered once 4) Youve got an extra pair of braces there too Cheers ...

12. how to write an O(nlgn) sorting algorithm using 3 stacks?    forums.oracle.com

Holy cow now this has got to be some really really blatent cheating... not your typical homework assignment tho. Maybe some extra credit or a content? I'm not going to give it away, but I'll give you a clue. Think about how MergeSort and QuickSort work. They both have a central idea in common. You can use that same idea with ...

13. sorting algorithm ?    forums.oracle.com

It works on binary search algorithm. This algorithm has two forms. The first takes a List and an element to search for (the "search key"). This form assumes that the List is sorted in ascending order according to the natural ordering of its elements. The second form takes a Comparator in addition to the List and the search key. int pos ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.