Sort numbers from two lists

Hello,
I have two ordered lists LIST1 and LIST2 which elements are composed
of a field named "value" (an integer number) and a field named "prox"
that points on the following element ("nil" when there aren't new
elements).
The elements are disposes in each list in crescent order of value.
What's the optimal Java algorithm to print in crescent order the
combination of the elements of both lists?
For example, if the first list is formed by values 8, 12, 13, 28, and
the second by values 10, 11, 35, it must print the list 8, 10, 11, 12,
13, 28, 35.
Thanks in advance to all
Dario

Hello,
I have two ordered lists LIST1 and LIST2 which
elements are composed
of a field named "value" (an integer number) and a
field named "prox"
that points on the following element ("nil" when
there aren't new
elements).
The elements are disposes in each list in crescent
order of value.
What's the optimal Java algorithm to print *in
crescent order* the
combination of the elements of both lists?
For example, if the first list is formed by values 8,
12, 13, 28, and
the second by values 10, 11, 35, it must print the
list 8, 10, 11, 12,
13, 28, 35.
Thanks in advance to all
DarioPlease present your algorithm in the form of pseudocode and
tell us where you have problem with Java.
this will pinpoint your problem and hence you will get faster response.
thanks

Similar Messages

  • Query and sort content from two lists using search API

    Hi,
    I have a custom web part which I would like to query two different lists and sort the results by Created Date. One is a list of news articles and the other contains blogs. So basically the result set will be an intermix of news and blog items sorted by date.
    I would also like to do this by query through the search API. Does anybody have any sample code to do this?
    thanks,
    Sherazad.
    Sherazad

    Hi Sherazad:
    To use the JOIN operator in CAML, your lists must have a
    defined relation(Lookup column). You can refer to sample code that I list as follow.
    Create your query from one of your lists.
    SPList Projects= SPContext.Current.Site.RootWeb.Lists["Projects"];
    SPQuery query = new SPQuery();
    To do the join, setquery.Joins
     <Join Type="INNER" ListAlias="Contacts">
        <Eq>
            <FieldRef Name="ProjectManager" RefType="ID" /> ///
    ProjectManager is a Lookup Column.
            <FieldRef List="Contacts" Name="ID" />
        </Eq>
     </Join>
    And query.ProjectedFields (To tell SharePoint how to project the lookup columns into the result)
    <Field Name="Project Name" Type="Lookup" List="Projects" ShowField="Title">
    /// My Project Name is a Display Name in Memory so you can give a name by yourself But ShowField must be Internal Name of the Column(Project Name)
    You can add a lot of columns that you want to display.
    Everything comes from memory.
    To choose the fields to display set query.ViewFields
    <FieldRef Name="Your Internal Name of Column Or
    ProjectedFields - Field Name">
    <FieldRef Name="Your Internal Name of Column Or
    ProjectedFields - Field Name">
    <FieldRef Name="Your Internal Name of Column Or
    ProjectedFields - Field Name"> 
    Then
    SPListItemCollection result = ListA.GetItems(query);

  • I am wanting to exactly match two ID numbers from two differing worksheets within one work book. Once matched I am wanting to retrieve a row value from the second worksheet into the first. Any help much appreciated.

    I am wanting to exactly match two ID numbers from two worksheets within the one work book. ID numbers are non linear. Once exactly matched I wish to retrieve a corresponding row value from worksheet two and have it appear in worksheet one against the correct ID number. I have been looking at IF, VLOOKUP, and MATCH functions and suspect that what I want to do requires a combination of two or more. Any help will be greatly appreciated.
    regards Vaughanh

    Vaughan,
    Data A:D is all cells start at column A thru column D.
    There is built-in help using the menu item "View > Show Function Browser"  in the search field (top right) you can enter vlookup and you will see the detailed description.
    From this we see:
    VLOOKUP
    (search-for, columns-range, return-column, close-match)
    search-for:  The value to find. search-value can contain any value type.
    columns-range:  A range of cells. range is a reference to a single range of cells, which may contain values of any type.
    return-column:  A number that specifies the relative column number of the cell from which to return the value. return-column is a number value. The leftmost column in the range is column 1.
    close-match:  An optional value that determines whether an exact match is required.
    close match (TRUE, 1, or omitted):  If there’s no exact match, select the column with the largest top-row value that is less than the search value. Wildcards can’t be used in search-for.
    exact match (FALSE or 0):  If there’s no exact match, return an error. Wildcards can be used in search-for.
    So... the 2,0 means return the value form the same row as the lookup value but from the 2nd column of the range.  3, 0 means from the 3rd column.  the ", 0" means exact match

  • Showing updated items from two lists ?

    Hi SharePoint Experts,
    I have created two custom lists in top level site, For accomplishing my task, I have used DataView to show all items from the two lists order by modify. Of course, this DataView webpart showing data but which is not in proper way.
    And also show status column from workflow which is actually from different groups.
    Is dashboards  suitable to my task? Is dashboards capable to show data from two list ? also status column from workflow.
    Appreciate if any suggestions..
    Thank you.

    Hi,
    As you are using SharePoint 2013 you can use the Content search web part to display the data from multiple list.
    Please refer to the similar post, which has detailed steps how to use the content search web part.
    http://sharepoint.stackexchange.com/questions/112085/how-to-get-data-from-multiple-table-or-list-in-sharepoint-2013
    If you still persists to use the Dataview web part, please refer to the following article.
    http://sp2013.blogspot.de/2013/11/two-sharepoint-lists-in-dataview-linked.html
    Please don't forget to mark it as answered, if your problem resolved or helpful.

  • How to remove a Sort button from ALV List

    Hi Experts,
    How to remove sort button from ALV List.
    I have requirement where I need to remove the sort button from ALV list.
    Kindly give me useful clues.
    Higher points will be awarded for the useful inputs.
    Thanks in Advance,
    Dharani

    Hi dharani,
    1. UP and Down Sort Button will get removed.
    2. Important code is marked in bold
    3. Just copy paste.
    4.
    report abc.
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvfcwa TYPE slis_fieldcat_alv.
    <b>data : excl type SLIS_T_EXTAB.
    data : exclwa type SLIS_EXTAB.</b>
    data : begin of itab occurs 0.
            include structure usr02.
    data : end of itab.
    START-OF-SELECTION.
      select * from usr02
      into table itab.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-repid
          i_internal_tabname     = 'ITAB'
          i_inclname             = sy-repid
        CHANGING
          ct_fieldcat            = alvfc
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
    <b>*----
    IMPORTANT
    fcodes to remove
    Up and Down Sort Button
    exclwa-fcode = '&OUP'.
    append exclwa to excl.
    exclwa-fcode = '&ODN'.
    append exclwa to excl.</b>
    Display
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_fieldcat   = alvfc
          <b>IT_EXCLUDING     = excl</b>
        TABLES
          t_outtab      = itab
        EXCEPTIONS
          program_error = 1
          OTHERS        = 2.
    regards,
    amit m.

  • How do I generate random numbers from a list of numbers without repeating any number

    I am trying to generate a list of random numbers without any repeating numbers.  For example say the list is from 1 to 15, how do I randomly generate a list of numbers using each number only once?

    pb,
    You can build a randomizer by making a 2-column table with 15 rows. In Column A, Fill with the numbers 1 to 15. In column B Fill with RAND(). Then sort on Column B. There will now be a randomized list of the numbers from 1 to 15 in Column A. You can copy this random list and use it in your application.
    Jerry

  • Can't make calls to numbers from contact list or c...

    I have a Nokia N95 8GB and have the same problem. I can key in a number and dial it, but am unable to dial from the contact list or from the call register. If I restart the phone, I am able to dial numbers from my phone book, but after some time, the same problem takes over. Any suggestions?

    Me too have same problem, guys please help !!

  • Can I swap the CS2 registration numbers from two computers?

    Is there a way to swap two CS2 registration numbers on two computers without reinstalling the whole lot? Thanks!
    Paul

    I'm not so sure it can't be done. I don't remember the way CS2 worked
    but once you deactivate you may be prompted to remove the serial number
    from the machine. Go ahead and do that for both and then reactivate
    entering the correct serial number on the opposite machines.
    Bob

  • Get data from two list simultaneously using REST

    Is it possible to query two list in the same time?
    url: http://sites.com/url/_api/web/lists/GetByTitle(‘List1')
    url: http://sites.com/url/_api/web/lists/GetByTitle(‘List1' and 'List2')
    Thanks in advance

    Hi ,
    By default SharePoint doesn't provide this kind of rest service or server object model api to retrieve the specified multiple lists once, it could only get all lists or one specified list one time.
    you may query twice to get two lists as a workaround.
    http://msdn.microsoft.com/en-us/library/office/fp142380(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/jj246453.aspx
    Thanks
    Daniel Yang
    TechNet Community Support

  • Access data from from two lists based on lookup columns and insert into another

    Hi,
    I am new in SharePoint and is stuck in some problem.
    I want to insert data in to a list by fetching data from 2 lists.
    The scenario is :
    List A Columns : EmployeeName, EmployeeID, EmployeeSalary 
    List B Columns : DepartmentName, EmployeeID, ManagerID
    EmployeeID is lookup column 
    I want to fetch data from these 2 lists and insert data into another list:
    List C Columns: EmployeeName, EmployeeSalary, DepartmentName 
    Can someone please explain me all the possible approaches to do the above task

    If ListA and ListB are the lists that you created, it would be better to generate the lists data into one list not seperate lists, as they both represents the property information of one employee.
    If they are existing lists, you may have following considerations:
    1. if you are a programmer, it would be easier to have a lookup column at ListA, to generate the EmployeeName, EmplyeeSalary, then using ItemAdded event, to generate the DepartmentName column based on EmployeeID column.
    2. have a lookup column look at ListA, use workflow, set when item is created, start the workflow automatically, then in the workflow, find ListB related item based on EmployeeID column, to set the DepartmentName column, SharePoint designer workflow
    set Item Value activity can do this work, you can research to find more information about how to do this.
    Thanks,
    Qiao Wei <br/> My blog:http://blog.goobol.com

  • Pull information from two list

    I have two list setup like the below sample.
    List A List B
    NAME NUMBER.
    ACCOUNT NODE#
    Eric 1234
    nn-1234-aa 7
    I need a way that i can match account in list B with number in list A and pull node# with it.
    I would like to get this¦
    NAME.       NUMBER.
    NODE#
    Eric 1234
    7
    Is this possible and if so any help would be great.
    Thanks,
    Eric Ray
    Eric

    I have two list setup like the below sample.
    List A List B
    NAME NUMBER
    ACCOUNT NODE#
    Eric 1234
    nn-1234-aa 7
    I need a way that i can match account in list B with number in list A and pull node# with it.
    I would like to get this¦
    NAME NUMBER
    NODE#
    Eric 1234
    7
    Is this possible and if so any help would be great.
    Thanks,
    Eric Ray
    Eric

  • Lightroom not merging and sorting images from two different cameras - help please !!

    Hi guys,
    I need some help here. I've just imported a few thousands of images form two different cameras, however Lightroom simply sorts them by camera only. (i.e.. images from the first camera, all sorted by capture time, then come images form the second camera.)
    The cameras are the same brand and model, times are synchronised, but the images refuse to merge and sort. I've tried putting them in the same folder and importing, but that doesn't do it either. I've been doing this for years and it all worked fine, till today. Does anyone know whats causing this, and how I can fix it?
    Thanks in anticipation.
    Latch

    Hi John,
    View > Sort > Capture Time is checked, The cameras are in sync down to the second, and images from both have been merging and sorting fine for over two years, till today. Sort order is all set to capture time in all modes and views, but its still sorting first by camera.

  • How can I sort photos from two users into one

    I have two users on my Mac and I am trying to get all my photos onto my new External hard drive.  I want one user, one photo library stored on my external hard drive.  Help!

    If you have Aperture 3.3 or later and iPhoto 9.3 or later you can merge libraries with Aperture.
    Otherwise the only way to merge Libraries is with the paid ($20) version of iPhoto Library Manager

  • How can i subtract two numeric numeric numbers from two switch cases ?

    I have two switch cases in my labView program. I can see them individually on front panel but i need to subtract them and see the result on front panel. 
    Can someone please help me out...
    I am trying to display (Result1 - Result 2) on my front panel. Result1 and Result2 will change with time.
    Regards,
    Awais 
    Attachments:
    play4.vi ‏122 KB

    Move result 1 and result 2 out of the case structures and subract them.
    Right now result 1 or result 2 only get written to if its respective comparison is true.  What do you want to do with the math if either comparison is false?  You haven't defined your problem clearly enough.

  • Saving the data from two info path forms in to a single list in share point 2010

    Hi ,
    I have two  info path forms are in share point page FM 1 and FM 2.
    In FM 1 I am getting data from lists by using drop down and casket drop down  and FM 2 i need to enter manually after entering
    i want to save both forms information(FM 1 & FM 2 ) in to a single list of  share point 2010
     If any knows the solution please reply me  
    Thanking You,
    Arun Darly

    Hi,
    Based on your description, my understanding is that you want to save the data from two info path forms in to a single list in share point 2010.
    We can't save the data from two info path forms in to a single list, but we can
    save the data from two info path forms in to a single library.
    Open the  FM 1 and FM 2 in Infopath(you have save it Locally once).
    Publish the FM 1 and FM 2 as content types named FM 1 and FM 2.
    Add the content types FM 1 and FM 2 into a document library, Then you can save the data
    from two info path forms in to a single library.
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

Maybe you are looking for

  • Convert SD Material to DV-AVI First? A Little Story

    I was handed a simple little Project recently. The Assets were 18 WMV files with different Frame Sizes and different PAR’s. The end result was to be DVD-Video, Widescreen (16:9). I was in a bad mood, as I felt that there were better files to work wit

  • Missing events in ical

    How do you fix iCal issues that is missing certain events?  They show up on the mac but not on the iPhone...only some events are missing and it's from the same calendar. 

  • Java Program accessing hardware driver

    I am planning to develope a project with a USB smart card reader. The USB smart card reader is for some form of authenication purpose of the card holder to verify that the authenticated user is using the program. The application will be a web based p

  • How to load the CategoryName, instead of CategoryID in ListView?

    I have a Listview control in a Windows Form. The listview contains 3 columns - CategoryID - Product Description - Price The question is: how to load the "Category Name", instead of "Category ID"? Does listview support Dictonary Blinding? Please help

  • TS4147 how to remove duplicates in contacts in multiples

    I am having difficulty in removing multple duplicate and unwanted addresses in my icloud contact list and to remove each of them it will take ages. THere are about 7000 contacts!!! IS there a way to remove them in multiples so that I save time. I am