Linked List for custom insertion sorting not listing

Hello fellow humans! :3 this is an assignment; the little menu's options are the tasks it's supposed to perform. Sadly, case 1 only records the last valid (non -1) entry instead of building a list. case 2 does the same, except for actually recording the ending value (-1) instead of the last valid entry. Cases 3 and 4 are completely useless without the first two; I've included them because being quite new I'd rather not exclude anything important.
class with main method follows:
package batch2;
import java.io.*;
class e21
public static void main (String []args) throws IOException, NumberFormatException
BufferedReader input = new BufferedReader (new InputStreamReader (System.in));
FromKeyboard key = new FromKeyboard();
int a, option = 0, lrg;
MyList alist, blist, clist;
char fin = 'v';
boolean avac, bvac, cvac, bord;
NodeLD nodeaux = null;
alist = new MyList();
blist = new MyList();
clist = new MyList();
do{
  System.out.println("Please choose an option:");
  System.out.println("1. Create list 'A' sorting by insertion");
  System.out.println("2. Create list 'B', unsorted");
  System.out.println("3. Sort list 'B'");
  System.out.println("4. Mix lists 'A' & 'B' into a new sorted list 'C'");
  System.out.println("9. Exit");
  option = key.enterInt();
  switch (option){
  case 1: //this only records the last valid (non -1) entry D:
         System.out.println("Enter the integers you wish you sort in list 'A'");
      System.out.println("To finish, enter '-1'");
      a = key.enterInt();
      if (a != -1){
        alist.insertToList(a);
        System.out.println("Test 1");     
      while (a != -1){
           a = key.enterInt();
        if (a != -1){
          System.out.println("Test 1.1");
          nodeaux = new NodeLD();
          nodeaux.theData(a);
          alist.sortInserList(nodeaux);
          System.out.println("Test 2, a="+a+"");
     System.out.println("List 'A', sorted by insertion:");
      alist.seeList();
    break;               
  case 2: //this also keeps the last value, yet not a valid one but the '-1' for the ending condition
         System.out.println("Enter the integers you wish to add to list 'B'");
         System.out.println("Enter '-1' to finish");
         a = 0;
         while (a != -1){
            if (a != -1){
              a = key.enterInt();
              clist.insertToList(a);
         System.out.println("Unsorted list:");
         clist.seeList();
    break;
  case 3:
        while (clist.front != null){
      if (clist.front != null){
         blist.sortInserList(clist.front);
         clist.front = clist.front.givePrevious();
      System.out.println("List 'B', sorted");
      blist.seeList();
    break;
  case 4:
        while (blist.front != null){
     if (blist.front != null){
      alist.sortInserList(blist.front);
      blist.front = blist.front.givePrevious();
     System.out.println("List 'C', combining 'A' & 'B', sorted");
     clist.seeList();
    break;
  case 9:
     System.out.println("Program ended");
    break;
  default:
     System.out.println("Invalid option");
    break;
while (option != 9);
}Custom list class follows:
package batch2;
class MyList
boolean tag = false;
protected NodeLD front;
protected int size;
public MyList(){
     front = null;
     size = 0;
public void insertToList(int x){
     NodeLD t;
     t = new NodeLD();
     t.theData(x);
     t.theNext(front);
     if(front!=null){
          front.thePrevious(t);
     front = t;
     size++;
public void seeList(){
     NodeLD g;
     g = front;
     System.out.println();
     while (g!=null){
       System.out.println(""+g.dat+"");
       g = g.givePrevious();
     System.out.println("=============================");
public int sortInserList(NodeLD g){
     NodeLD pointer = new NodeLD();
     pointer = front;
     NodeLD prepointer = new NodeLD();
     System.out.println("Test A");
     while (g.dat > pointer.dat && pointer != null){
       if (pointer.giveNext()!= null){
        pointer = pointer.giveNext();
        tag = false;
        System.out.println("Test A.b");
       else if (pointer.giveNext() == null) {
        tag = true;
        System.out.println("Test A.c");
       break;
     prepointer = pointer.givePrevious();
     if (pointer == null || tag){
       insertToList(g.dat);
       System.out.println("Test B. Pointer == null or tag == true");
     if (prepointer != null && !tag){
       g.thePrevious(prepointer);
       prepointer.theNext(g);
       System.out.println("Test C. prepointer != null && !tag");
     if (pointer != null && !tag){
       g.theNext(pointer);
       pointer.thePrevious(g);          
       System.out.println("Test D. pointer !=null && !tag");
     System.out.println("Test E. Right before return");
     return g.dat;
}And here comes the accompanying Node class:
package batch2;
class NodeLD
private int data;
private NodeLD next;
private NodeLD previous;
public int dat;
NodeLD(){
     data = 0;
     next = null;
     previous = null;
     dat = data;
public void theData(int x){
     data = x;
     dat = data;
public void theNext(NodeLD y){
     next = y;
public void thePrevious(NodeLD z){
     previous = z;
public int giveData(){
     return data;
public NodeLD giveNext(){
     return next;
public NodeLD givePrevious(){
     return previous;
}And last but not least, the part of FromKeyboard I'm using for this exercise, just in case:
package batch2;
import java.io.*;
public class FromKeyboard
public BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
public int enterInt(){
     System.out.flush();
     int integ = -1;
     try{
          integ = Integer.valueOf(input.readLine());
     catch(NumberFormatException e){
          System.err.println("Error: "+e.getMessage()+"");
     catch(IOException t){
          System.err.println("Error: "+t.getMessage()+"");
     return integ;
}All help with regards as to why my lists aren't working and general comments/nudges on the sorting are welcome and appreciated.

Hi Kevin, thank you for replying! I'll trim my code in a moment; as for a specific inquiry:
>Sadly, case 1 only records the last valid (non -1) entry instead of building a list. case 2 does the same, except for actually recording the ending value (-1) instead of the last valid entry. >
More direct approach to asking for help: These classes compile correctly and run, although the result is not what I'm aiming for: I get a single-noded list instead of the full list. Why isn't it keeping all the nodes but the last one only?
Edited by: SquaredCircle on 09-Sep-2010 16:46
That was fun :D this is my SSCCE for the main class:
class e21SSCCE
public static void main (String []args) throws NumberFormatException
int a[] = {14, 25, 11, 43, 33, -1}, key[] = {1,2,9}, option = 0, i = 0, e = 0;
MyList alist, clist;
char fin = 'v';
NodeLD nodeaux = null;
alist = new MyList();
clist = new MyList();
do{
  System.out.println("Please choose an option:");
  System.out.println("1. Create list 'A' sorting by insertion");
  System.out.println("2. Create list 'C', unsorted");
System.out.println("9. Exit");
  option = key[e];
  e++;
  switch (option){
  case 1: //this only records the last valid (non -1) entry D:
         System.out.println("Enter the integers you wish you sort in list 'A'");
      System.out.println("To finish, enter '-1'");
      i = 0;
      if (a[i] != -1){
        alist.insertToList(a);
     i++;
     while (a[i] != -1){
if (a[i] != -1){
     nodeaux = new NodeLD();
     nodeaux.theData(a[i]);
     alist.sortInserList(nodeaux);
     i++;
     System.out.println("List 'A', sorted by insertion:");
     alist.seeList();
break;               
case 2: //this also keeps the last value, yet not a valid one but the '-1' for the ending condition
System.out.println("Enter the integers you wish to add to list 'B'");
System.out.println("Enter '-1' to finish");
i = 0;
while (a[i] != -1){
if (a[i] != -1){
clist.insertToList(a[i]);
                    i++;     
System.out.println("Unsorted list:");
clist.seeList();
break;
case 9:
     System.out.println("Program ended");
break;
default:
     System.out.println("Invalid option");
break;
while (option != 9);
The cleaner version of the list class:class MyList
boolean tag = false;
protected NodeLD front;
protected int size;
public MyList(){
     front = null;
     size = 0;
public void insertToList(int x){
     NodeLD t;
     t = new NodeLD();
     t.theData(x);
     t.theNext(front);
     if(front!=null){
          front.thePrevious(t);
     front = t;
     size++;
public void seeList(){
     NodeLD g;
     g = front;
     System.out.println();
     while (g!=null){
          System.out.println(""+g.dat+"");
          g = g.givePrevious();
     System.out.println("=============================");
public int sortInserList(NodeLD g){
     NodeLD pointer = new NodeLD();
     pointer = front;
     NodeLD prepointer = new NodeLD();
     while (g.dat > pointer.dat && pointer != null){
          if (pointer.giveNext()!= null){
               pointer = pointer.giveNext();
               tag = false;
          else if (pointer.giveNext() == null) {
               tag = true;
               break;
          prepointer = pointer.givePrevious();
          if (pointer == null || tag){
               insertToList(g.dat);
          if (prepointer != null && !tag){
               g.thePrevious(prepointer);
               prepointer.theNext(g);
          if (pointer != null && !tag){
               g.theNext(pointer);
               pointer.thePrevious(g);          
     return g.dat;
And the node class:class NodeLD
private int data;
private NodeLD next;
private NodeLD previous;
public int dat;
NodeLD(){
     data = 0;
     next = null;
     previous = null;
     dat = data;
public void theData(int x){
     data = x;
     dat = data;
public void theNext(NodeLD y){
     next = y;
public void thePrevious(NodeLD z){
     previous = z;
public int giveData(){
     return data;
public NodeLD giveNext(){
     return next;
public NodeLD givePrevious(){
     return previous;
I followed the SSCCE guideline, and tried my best with it. The indentation checker was a broken link, though :c.
Edited by: SquaredCircle on 09-Sep-2010 17:12                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Incompatibility for custom Report is not working properly

    Hi Gurus,
    Need your help to diagnose the issue here.
    The problem here is as under
    We have a custom report CP1 which fills a table T1 during the process (table is truncated in the begining of the procedure). This CP1 is set incompatible to itself so that table architecture will work properly.
    but the problen here is the next run starts ( 2sec, 5 secs or 10 secs) prior to the actual completion of the last run.
    the data is as
    CONCURRENT_ REQUEST ACTUAL_START ACTUAL_COMPLETION_
    PROGRAM_ID ID                DATE     DATE
    138361     3033673     7/3/2012 10:31:46 AM     7/3/2012 10:57:13 AM
    138361     3033671     7/3/2012 10:28:47 AM     7/3/2012 10:31:42 AM
    138361     3033670     7/3/2012 10:25:22 AM     7/3/2012 10:28:48 AM
    138361     3033669     7/2/2012 7:07:21 PM     7/3/2012 10:25:37 AM
    138361     3033665     7/2/2012 7:05:10 PM     7/2/2012 7:07:15 PM
    here as you see the req 3033670 starts @7/3/2012 10:25:22 AM whereas the req 3033669 ends at 7/3/2012 10:25:37 AM (though we have terminated the 3033669 ) similarly for 3033670 and 3033671.
    the following query is giving 1 row
    select * from FND_CONCURRENT_PROGRAM_SERIAL
    where RUNNING_CONCURRENT_PROGRAM_ID = 138361 is
    We have bounced the CM after setting the incompatibility as per the
    Setting up Incompatibility Rules for Custom Reports [ID 107224.1] suggested by Hussein on this forum.
    This is happening on our prod env. kindly suggest something.
    We are on 12.1.1 (r12).
    Thanks
    -Shivdeep Singh
    Edited by: user1054040 on Jul 2, 2012 10:58 PM

    Hi Srini,
    We have raised a SR with oracle for this it seems to be a bug in 12.1.1 release I will update the same once I got any fix or patch from oracle.
    from the intial investigation it seems to be that the imcompatibility wit itself feature is not working as expected.
    Also this is the latest case
    CONCURRENT_
    PROGRAM_ID REQUEST_ID ACTUAL_START_DATE ACTUAL_COMPLETION_DATE COMPLETION_TEXT
    150364     3036174     7/3/2012 4:55:03 PM     7/3/2012 4:57:04 PM     Normal completion
    150364     3036178     7/3/2012 4:55:57 PM     7/3/2012 4:57:47 PM     Normal completion
    150364     3036181     7/3/2012 4:57:27 PM     7/3/2012 4:58:09 PM     Normal completion
    the request id 3036178 should have been started after the completion of 3036174 ie after 7/3/2012 4:57:04 PM but it actually starts 7/3/2012 4:55:57 PM
    hope this give the better understanding for the scenario here.
    Thanks
    -Shivdeep Singh
    Edited by: user1054040 on Jul 4, 2012 11:36 PM

  • For Customer service complaint not a happy customer

    Where do I even start! I called about 4 times had issues with my dial tone on my phone. Had the same customer service rep attend my call did not help at all but dislike her attitude and her way of customer service very rude and unprofessional. I had the same issue happen to me before and did not have this entire drama go on like this, but my issue was taken care off right there and then. Her name was alissa or elissa one of those I was very upset then she hanged up on me. I called back this time i had a man for a representative and he then transfers the call to the same rep female and she raised her voice at me. I was hanged up once more i called again asked to speak to the supervisor another customer service female rep did the same thing and said she'll help me and was testing my phone line and while I was using my cell to call her she hanged up again. I've never been so disappointed with comcast after all the years I've been using their service.. now I would have to decide if i still want to keep using their cable services.

    EP2005 wrote:
    Where do I even start! I called about 4 times had issues with my dial tone on my phone. Had the same customer service rep attend my call did not help at all but dislike her attitude and her way of customer service very rude and unprofessional. I had the same issue happen to me before and did not have this entire drama go on like this, but my issue was taken care off right there and then. Her name was alissa or elissa one of those I was very upset then she hanged up on me. I called back this time i had a man for a representative and he then transfers the call to the same rep female and she raised her voice at me. I was hanged up once more i called again asked to speak to the supervisor another customer service female rep did the same thing and said she'll help me and was testing my phone line and while I was using my cell to call her she hanged up again. I've never been so disappointed with comcast after all the years I've been using their service.. now I would have to decide if i still want to keep using their cable services.To report this and get your services repaired try this: Send an email to:     [email protected]
    Include all of your information, full name, service address, phone numbers where you can be reached easily, as well as the phone number associated with your account, your account number, and details about all the issues you have been having. Also include a link to this post.

  • Reset Processing Status function for Custom Document does not exist?

    Expert,
    I have a need to reset Process Status of Custom Document from
    "Blocked - Awaiting Reply from Authorities" to previous status. Many times we will receive error messages from US AES and require further processing and resent.
    According to help.sap.com documentation, i should be able to find this function through
    System Administration. Choose System Monitoring ® Status of Customs Declarations/Shipments.
    I don't seem to be able to find this in our GTS 7.20 system. I have SP 009.
    Please help.
    Thank you,
    Wen

    ok. I received the answer from SAP. The transaction to reset processing status of custom declaration is
    /n/SAPSLL/CDOC_STARES accessible through role Menu /SAPSLL/LEG_SYS_COMM.
    Wen

  • Sorting singly linked list with minimum time complexity

    Hi ...
    anyone could tell me how can i sort singly linked list with minimum time complexity .... ????
    Regards...

    By MergeSort or QuickSort O(n log n). But then you
    have to first extract the objects in the list,sort
    them, then rebuild the list. But it will still bealot
    faster than by keeping the list linked.Technically, I believe insertion sort is marginally
    faster for small n ( <20 or so).Woohoo! So for 20 out of the possible 2147483648 array
    sizes Insetion is faster!
    Unfortunately, checking for that case probably wastes
    all the time you get from using the faster sort...
    That would depend on the actual distribution off array sizes. So it's an engineering decision.
    Sylvia.

  • Selection Sort using Linked Lists

    As the subject says, I'm trying to implement a selection sort method on a linked list structure. I've already created a bubble sort, but I can't seem to get this method to work correctly. The Node and LinkedList classes were written by me, and I know they work correctly (because of the other methods work right).
    public void selectionSort(LinkedList list) {
            int iterationsINNER = 1, iterationsOUTER = 1, swaps = 0, comparisons = 1;
            if(list.isEmpty())
                System.out.println("List is currently empty.");
            else if (list.size() == 1)
                System.out.println("List is already sorted.");
            else {
                Node pointer = list.getFirst();
                Node current;
                boolean exchangeMade;
                while (pointer.getNext().getNext() != null) {
                    current = pointer;
                    exchangeMade = false;
                    iterationsOUTER++;
                    while (current.getNext() != null && !exchangeMade) {
                        if(current.getNext().getData() < pointer.getData()) {
                            int temp = pointer.getData();
                            pointer.setData(current.getNext().getData());
                            current.getNext().setData(temp);
                            exchangeMade = true;
                            iterationsINNER++;
                            swaps++;
                            comparisons++;
                        current = current.getNext();
                    pointer = pointer.getNext();
              //  System.out.println("Comparisons: " + comparisons + " \nSwaps: " + swaps + " \nIterations: " + iterationsINNER+iterationsOUTER);
        }For instance, if I run this bit of code...
    LinkedList list = new LinkedList();
            list.insert(5);
            list.insert(29);
            list.insert(2);
            list.insert(1);
            list.insert(13);
            list.insert(8);
            list.insert(30);
            list.insert(3);
            sort.selectionSort(list);
            list.print();The output is...
    1
    8
    13
    3
    2
    29
    30
    5
    Anyone have any idea what is going wrong, or is anymore information needed?
    PS: I also need to create a insertion sort method with this, and I've been told I need to reverse the list for the insertion sort to work correctly. Any tips on how to implement this method too? :)

    I've changed it up a bit, and it works, but is this still a bubble sort? I've tried uncommenting that section that keeps track of the iterations and such, but I know they can't be right. Does this look correct? I basically just removed that boolean check...
    public void selectionSort(LinkedList list) {
            int iterationsINNER = 1, iterationsOUTER = 1, swaps = 0, comparisons = 1;
            if(list.isEmpty())
                System.out.println("List is currently empty.");
            else if (list.size() == 1)
                System.out.println("List is already sorted.");
            else {
                Node pointer = list.getFirst();
                Node current;
                while (pointer.getNext() != null) {
                    current = pointer;
                    iterationsOUTER++;
                    while (current.getNext() != null) {
                        comparisons++;
                        if(current.getNext().getData() < pointer.getData()) {
                            int temp = pointer.getData();
                            pointer.setData(current.getNext().getData());
                            current.getNext().setData(temp);
                            iterationsINNER++;
                            swaps++;
                        current = current.getNext();
                    pointer = pointer.getNext();
                System.out.println("Comparisons: " + comparisons + " \nSwaps: " + swaps + " \nIterations: " + iterationsINNER+iterationsOUTER);
        }And no, I tried and I don't get a NullPointerException if I have a list of 2.
    Edited by: birdboy30 on Dec 3, 2007 7:23 PM

  • Logical database PNP not retrieving data for custom infotypes.

    Hi all,
    I am using logical database PNP in a program. I have declared infotypes as follows:
    INFOTYPES: 0001, 0002, 0041, 9801, 9840.
    The problem is that the logical database is retrieving data for the standard infotypes but not for the custom infotypes. Any explanation as to why data for custom infotypes is not being retireved and how this can be solved will be greatly appreciated.
    regards,
    Hamza

    solved

  • Syntax problem in insertion sort

    What I'm trying to do is use different types of algorithims, to sort the text file.
    I'm using bubble, selection, and insertion sorts, which are being implemented with an arraylist. The bubble, and selection, comes out fine, but having problems getting the syntax right for the insertion sort.
    The error comes in the inner for loop when I try to compare tmp and data.get(j-1) I get this error "The operator && is undefined for the argument type(s) boolean, int. Obviously I screwed this part of the coding, and I need help trying to figure out how to correct it. Thanks for any help.
    public static void insertionSort (List data)
                 Comparable tmp;
              int i, j;
                 for(i = 1; i < data.size(); i++)
                      tmp =  (Comparable)data.get(i);
                       for(j = i; j > 0 && tmp.compareTo(data.get(j - 1)) ; j--) // <--- right here
                            data.set(j, data.get(j - 1))  ;
                       data.set(j, tmp)  ;
    }

    You need to check whether the compareTo returns less
    than zero or greater than zero (depending on your
    sort order).
    (j > 0) && (tmp.compareTo(data.get(j - 1)) >
    0)I added parentheses around the two boolean
    expressions. Probably not necessary, but makes it
    easier to read--and you don't have to remember the
    operator precedence rules.
    You might want < 0 at the end--as I said, depends on
    your sort order.That fixed it thanks alot, oh and it was in decending order, so I just had to switch the ending part around.

  • Using DAC for custom Environment

    Hi All,
    I would like to know that, can we use DAC to schedule , run the loads for custom ETL environment(not BI APPS), does DACt supports. Below is is my set up
    -Oracle 11g DB(source and target )
    -Informatica 9 installed
    -Mappings, workflows are developed
    -DAC 11g is installed
    Now I want to set up DAC so that I can run loads from DAC instead of Informatica. Please any let me know high level steps. Is it different from BI APPS environmen if so kindly let me know configuration
    Thanks in advance

    Short answer is NO...as per licensing agreements, you can only use DAC and OBIA to load a OBIA DW target.
    pls mark correct

  • Mass Upload - Customer Contract Related Notes

    Hi Everyone,
    i am trying to find a BAPI or FM for Customer Contract Related Notes. T-code for this is UDM_SUPERVISOR . could anyone help with the FM or BAPI's which has these fields mentioned below: -
    COLL_SEGMENT
    PARTNER
    CCT_DATE
    CCT_GUID
    CUSTOMER
    CCT_ID
    COLL_SPECIALIST
    CASE_GUID
    TEXT_LINE
    Thanks
    Edited by: akshrao on Oct 28, 2010 4:14 PM

    Hi
    For this requirement you can use BDC to do,
    Just use the transaction SHDB to record your T-Code
    and use create program to do BDC program
    then you do mass upload, it would be easy to do..
    you can also get data from excel..
    Use FM WS_UPLOAD WS_DOWNLOAD

  • Credit master data for Customer

    Hi,
    I need solution for the below problem.
    Credit master data for Customer "X" is not maintained.
    Is there any possibility to get the information /Error message during sales order creation/Save for Customer "X" as Credit master data is not maintain.
    Information/Error message shouldd be:No credit master data maintain for Customer "X"
    Thanks for your help.
    Regards,
    Balaji.

    Hi
    You can use the followig user exit which will perform a check while saving the order.
    Take the help of your abaper to write a code to check if the credit master has been maintained for the customer before saving the order.
    Program,: MV45AFZZ
    USEREXIT_SAVE_DOCUMENT_PREPARE
    Use this user exit to make certain changes or checks immediately before saving a document. It is the last possibility for changing or checking a document before posting.
    The user exit is carried out at the beginning of the FORM routine BELEG_SICHERN.
    Regards
    Madhu

  • Class for customer use

    Hi All,
    Can you please tell me how can I found if a particular class is released for customer use or not?
    Thanks,
    Rajeev

    SAP says this with respect to class -
    Internally Released Indicator
    Until a comprehensive release concept is developed for a packet discussion, two levels of release exist:
    Not released, that is, this class is only a utility class and is not actually used
    Internally released, that is, this class can be restricted (see internal release of function modules). There are no stability guarantees for use outside of SAP.

  • Linked List Insertion Sort

    Can anyone help me figure out the code for a linked list insertion sort by only manipulating the references? or provide me to a link that will.
    I can't seem to get it going.
    Thanks

    Well, first you have to split this topic up into its two pertinent portions:
    First, you have to know how to do an insertion sort. If you don't know how to do that, here's a good quick example:
    http://web.engr.oregonstate.edu/~minoura/cs162/javaProgs/sort/InsertSort.html
    Next, you need to adapt this scheme to a linked list. The only real challenge here is knowing how to unlink an item in the list, relink it in the right place, and not disrupt the list. This is one of the first hits off google for the linked list:
    http://cslibrary.stanford.edu/103/

  • N^2 log(n) for Collections.sort() on a linked list in place?

    So, I was looking over the Java API regarding Collections.sort() on linked lists, and it says it dumps linked lists into an array so that it can call merge sort. Because, otherwise, sorting a linked list in place would lead to a complexity of O(n^2 log n) ... can someone explain how this happens?

    corlettk wrote:
    uj,
    ... there are other sorting methods for linked lists with an O(N*N) complexity.Please, what are those algorithms? I'm guesing they're variants off insertion sort, coz an insertion is O(1) in a linked list [and expensive in array]... Am I warm?You don't have to change the structure of a linked list to sort it. You can use an ordinary Bubblesort. (The list is repeatedly scanned. In each scan adjacent elements are compared and if they're in wrong order they're swapped. When one scan of the list passes without any swaps the list is sorted). This is an O(N*N) algoritm.
    What I mean is it's possible to sort a list with O(N*N) complexity. It doesn't have to be O(N*N*logN) as the Java documentation kind of suggests. In fact I wouldn't be surprised if there were special O(N*logN) algoritms available also for lists but I don't know really. In any case Java uses none of them.

  • Organizing entries in link list shall not be possible for standard users

    Hello,
    how can I avoid that a standard user can organize the entries in the iView <i>Links List</i>?
    That means the link 'Organize Entries' shall not be shown for them.
    Only the content manager shall be able to organize.
    Regards,
    Susanne

    I got the solution by myself:
    In the KM repositories click on the context menue of /documents/links and choose 'Details'.
    In the opened window choose Settings > Permissions and change the permission you like.

Maybe you are looking for