Click here to Skip to main content
15,917,005 members
Home / Discussions / Java
   

Java

 
GeneralRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
Nagy Vilmos27-Apr-11 5:43
professionalNagy Vilmos27-Apr-11 5:43 
GeneralRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
Richard MacCutchan27-Apr-11 6:53
mveRichard MacCutchan27-Apr-11 6:53 
GeneralRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
David Skelly28-Apr-11 1:48
David Skelly28-Apr-11 1:48 
GeneralRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
Richard MacCutchan28-Apr-11 5:54
mveRichard MacCutchan28-Apr-11 5:54 
AnswerRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
CoderForEver26-Apr-11 3:26
CoderForEver26-Apr-11 3:26 
GeneralRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
Richard MacCutchan26-Apr-11 10:15
mveRichard MacCutchan26-Apr-11 10:15 
AnswerRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
Luc Pattyn26-Apr-11 4:05
sitebuilderLuc Pattyn26-Apr-11 4:05 
AnswerRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
jschell26-Apr-11 8:03
jschell26-Apr-11 8:03 
AnswerRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
David Skelly26-Apr-11 22:16
David Skelly26-Apr-11 22:16 
RantRe: What is the problem accessing "C" drive using a code (using import.io.*; )? Pin
Richard MacCutchan26-Apr-11 22:28
mveRichard MacCutchan26-Apr-11 22:28 
QuestionIf string is a immutable class then how come it is allowing us to make changes ? Pin
shiva.kore23-Apr-11 7:11
shiva.kore23-Apr-11 7:11 
AnswerRe: If string is a immutable class then how come it is allowing us to make changes ? Pin
Luc Pattyn23-Apr-11 7:25
sitebuilderLuc Pattyn23-Apr-11 7:25 
GeneralRe: If string is a immutable class then how come it is allowing us to make changes ? Pin
shiva.kore23-Apr-11 7:45
shiva.kore23-Apr-11 7:45 
GeneralRe: If string is a immutable class then how come it is allowing us to make changes ? Pin
CoderForEver23-Apr-11 20:40
CoderForEver23-Apr-11 20:40 
QuestionDesktop notification application in java Pin
krutikaji22-Apr-11 7:32
krutikaji22-Apr-11 7:32 
AnswerRe: Desktop notification application in java Pin
jschell22-Apr-11 14:02
jschell22-Apr-11 14:02 
GeneralRe: Desktop notification application in java Pin
Richard MacCutchan22-Apr-11 22:40
mveRichard MacCutchan22-Apr-11 22:40 
GeneralRe: Desktop notification application in java Pin
TorstenH.25-Apr-11 11:58
TorstenH.25-Apr-11 11:58 
QuestionIn-place Merge-Sort with doubly linked list Pin
Manfr3d22-Apr-11 1:35
Manfr3d22-Apr-11 1:35 
Hello guys,

I have to write an in-place version of Merge-Sort which works on doubly linked lists for university.
This wouldn't be the problem, but there are a few conditions to meet.
- the algo must work in-place (additional memory usage in O(log n))
- I cannot create new list elements or entire lists, just copies (ListElement left = new List Element() isn't possible but ListElement left = first is possible)
- the algo should be recursive, but this is not necessary
- each call of the algo must return a head pointer to the first element of the sub-list
- the merge part must also return a head pointer
public DoublyLinkedList mergesort(DoublyLinkedList in, int numOfElements) {
		
        if (numOfElements > 1) {

            DoublyLinkedList firstLeft = in;
            DoublyLinkedList firstRight = in;

            for ( int i = 0; i < numOfElements / 2; i++ ) {
                firstRight.first = firstRight.first.next;
            }

            DoublyLinkedList left = mergesort ( firstLeft, (int)Math.floor(numOfElements / 2 ) );
            DoublyLinkedList right = mergesort ( firstRight, (int)Math.ceil(numOfElements / 2 ) );
            return merge ( left, right );

        } else {
            return in;
        }

}

My problem is that I'm somehow stuck right at the beginning. The algo itself shouldn't be the problem, but the additional conditions make the whole thing quite difficult for me.
Of course I've already searched for useful algos or something, but I didn't find anything.

Thanks in advance for your help and best wishes,
Manfred
AnswerRe: In-place Merge-Sort with doubly linked list Pin
TheLaughingManAnDerTU25-Apr-11 9:03
TheLaughingManAnDerTU25-Apr-11 9:03 
GeneralRe: In-place Merge-Sort with doubly linked list Pin
Manfr3d25-Apr-11 9:16
Manfr3d25-Apr-11 9:16 
GeneralRe: In-place Merge-Sort with doubly linked list Pin
TheLaughingManAnDerTU25-Apr-11 10:29
TheLaughingManAnDerTU25-Apr-11 10:29 
GeneralRe: In-place Merge-Sort with doubly linked list Pin
Manfr3d25-Apr-11 12:20
Manfr3d25-Apr-11 12:20 
GeneralRe: In-place Merge-Sort with doubly linked list Pin
JavaStudent_LA25-Apr-11 16:11
JavaStudent_LA25-Apr-11 16:11 
GeneralRe: In-place Merge-Sort with doubly linked list Pin
Manfr3d25-Apr-11 22:46
Manfr3d25-Apr-11 22:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.