rearrange

Algorithm: optimal way to rearrange a list from one order to another?

EDIT: I'm not sure that my original question is clear enough. I need an algorithm that will compute the minimal sequence of moves to rearrange an array from one order to another. It is known that both arrays will contain the same elements (no duplicates) and have the same length. For example: reorder( ['d', 'a', 'c', 'b', 'e'], [...

Python: Most efficient way to concatenate and rearrange files

Hi, I am reading from several files, each file is divided into 2 pieces, first a header section of a few thousand lines followed by a body of a few thousand. My problem is I need to concatenate these files into one file where all the headers are on the top followed by the body. Currently I am using two loops; one to pull out all the h...

Rearranging a sequence

I'm have trouble rearranging sequences so the amount of letters in the given original sequence are the same in the random generated sequences. For example: If i have a string 'AAAC' I need that string rearranged randomly so the amount of A's and C's are the same. ...

Rearrange items in ListBox

Hey, I have a ListBox with a number of ListBoxItem objects. What is the best way to allow users to rearrange the items by dragging and dropping? Do I have to use StackPanels instead? Thanks for any suggestions ...

Is there an easy way to drag items around in a ListView to change their order?

Let's say I have a ListView of items: Cat Dog Mouse And these are bound to the ListView via an adapter to a database. What I want to be able to do is to be able to re-order the list view,. For example I want to somehow drag "Mouse" up to the top of the list above "Cat". Once I have an order set, I then want to "save" the list and i...

Rearrange data [R]

I haven't quite got my head around R and how to rearrange data. I have an old SPSS data file that needs rearranging so I can conduct an ANOVA in R. My current data file has this format: ONE <- matrix(c(1, 2, 777.75, 609.30, 700.50, 623.45, 701.50, 629.95, 820.06, 651.95,"nofear","nofear"), nr=2,dimnames=list(c("1", "2"), c("SUBJECT","A...

[CSS] Move Right Menu to left?

I want to move a right menu to the left side, the problem is that I cant rearrange all the html, I have to do this with CSS. The HTML template looks like this: <style type="text/css"> #all{background:gray;width:400px} #content{ background:yellow;width:300px; position:absolute; margin-left:100px; float:left; } #menu{background:red;wi...

Scheme List Derangement (Rearrangement of sorts)

im trying to write a function in Scheme where i accept a list and return all the different derangements (look below for definition) as a list of lists derangement: A list where no item is in the same place as the original list ex: '(a b c) -> '(cab) any help is appreciated! ...