From 0adc0909dadb0188f7775b7c947a7b4fe5499565 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 7 May 2012 22:31:24 +0200 Subject: [PATCH] new post: swap in double-linked lists --- ...12-05-07-swap-in-double-linked-lists.markdown | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 _posts/2012-05-07-swap-in-double-linked-lists.markdown diff --git a/_posts/2012-05-07-swap-in-double-linked-lists.markdown b/_posts/2012-05-07-swap-in-double-linked-lists.markdown new file mode 100644 index 0000000..955724c --- /dev/null +++ b/_posts/2012-05-07-swap-in-double-linked-lists.markdown @@ -0,0 +1,16 @@ +--- +layout: post +title: swap in double-linked lists +date: 07.05.2012 22:22 +--- + +Yesterday I had to implement [Selection Sort](http://en.wikipedia.org/wiki/Selection_sort) +for double-linked lists and I had some trouble finding the correct solution +when it comes to swapping two elements. + +But I finally figured out how to correctly swap the pointers and I'll drop the +code here so others can use it (or even tell me about hidden bugs) + +I implemented it in Java, so see here: + +