[help]How to display the subsets

I'd like to know how to display the subsets of the set that has
k elements.
For example,
if a set S={a,b,c},
then its subset is
{a},,{c},{a,b},{b,c},{a,c},{a,b,c},null}.
How do I code the above program in Java?
Any help??

public class Subsets {
  public static void main(String[] args) {
    int k = Integer.parseInt(args[0]);
    int sets = 1 << k;
    for (int i = 0; i < sets; i++) {
      if (i <= 0) {
        System.out.print("{null}");
      else {
        StringBuffer buf = new StringBuffer();
        int j = i; char c = 'a';
        while (j > 0) {
          if ((j & 1) > 0) buf.append(c);
          j >>= 1; c++;
        System.out.print("{" + buf + "}");
    System.out.println();
}

Similar Messages

  • How to display the header data on different position in alv report

    hi all,
    how to display the header data on different position in alv report.
    for example ,
    customer                                                   name
      xxxx                                                         xxxx
                     vendor        name     street 
                      xxxx         xxxx      xxxxx
    pls   help me .

    hi
    as per my understanding you need to trnasfer header internal table data  to pdf..
    please check the following links for internal table to pdf..
    Convertion of Internal table data to PDF
    This link is related to ur issue
    Re: how to insert the calling of the FM: OTF to PDF
    Thanks

  • HOW TO DISPLAY THE TEXT ON A PARTICULAR PAGE IN SAPSCRIPTS

    HI,
       HOW TO DISPLAY THE TEXT ON A PARTICULAR PAGE IN SAPSCRIPTS?

    in ur script main window
    /: IF &TTXSY-PAGE& = 15.              
    ur text or standard text           
    /: ENDIF.                             
    use this.
    hope it helps if any issues revert back

  • How to display the Buyer's signature in PO BI Publisher Report

    Hi,
    How to display the Buyer's signature dynamically in XMLP Purchase Order Report.
    Please anybody help on this.Your help greatly appriciated.

    Hi All once again
    I was able to display the signature on XMLP AP Check Print Report by went through the follwoing Tim's blog http://blogs.oracle.com/xmlpublisher/2006/04/13#a12
    But in Purchase Order report requirement is different. We need to display the Buyer's signature on XMLP PO Report. So, where is the best place to store the buyers signatures.(For example if we have 10 buyers with 10 signatures respectively then after approving the PO, we should display that particular buyer's signature in PO XML Publisher report).We observed that in byuers & User's form there is no attachment feature enabled.
    This is an urgent requiremnt. Please help/guide/suggest to resolve this issue.
    Thanks in advance.

  • How to display the name of my metric in a PivotTable.

    Hi I am working with OBIEE Plus
    How to display the name of my metric in a PivotTable.
    Why when I add a field to the sector of the measures in a PivotTable field name disappears.
    Help please
    Thanks beforehand

    Where are your 'measure labels' ? These show what the metric is.

  • How to display the context of a Jbutton to a JTextField

    Hi,
    There is a key pad (1-9) on a GUI where each key is represented by a JButton. There is also a data entry filed, implemented using JTextField.
    However, when the user enters the ID using the key pad buttons each number should be displayed in the data entry field correspondingly (similar to calculator). I have already written the handlers for each button just don't know how to display the contexts in the text field, e.g. if the button 1 is pressed the 1 should be appeared in the text filed immediately. Anyone can help me to get this done?
    Thanks in advance,
    RMP

    Reza_mp wrote:
    .. Anyone can help me to get this done?In the actioPerformed method, call textField.setText( textField.getText() + "new data" )

  • How to display the value of a column in a chart at the top of each column

    How to display the value of each column in a chart at the top of each column?

    Like this?
    Done using chart Inspector.
    For details, see Chapter 7,  Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
    Regards,
    Barry

  • How to display the count of a list item in Sharepoint Designer?

    How to display the count of a list item in Sharepoint Designer? please reply with the proper code line to add for this.

    Hello,
    What version of sharepoint you are using? Try below approach:
    http://sharepointlogics.com/2010/03/total-count-of-items-in-list-in.html
    Hope it could help
    Hemendra: "Yesterday is just a memory,Tomorrow we may never see"
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer
    Please feel free to unmark answer if does not resolves your problem.

  • How to display the PK which is it alreday database sequence in a text field

    hi alllllllllllllll how to display the PK which is it alreday database sequence in a text field in form instance???

    2 ways,
    1) select the item in your SQL query and call it item_display - then you can treat it as a normal item with no impact on the database.
    2) Set the item to a display only item.
    Hope this helps,
    Russell

  • How to Display the Predefault Date Time

    Hi frnds,
    How to display the Default DateTime in the date field via sctipting i have a requirementy to show in one of the date field as next day's date with 9:00 a.m time stamp(2/15/2010 9:00 A.M) the data type of that field& column is UTC_datetime.please help i am getting.
    siebel bee

    Have a look at the function Today(), TimeStamp() and ToChar()
    You should be able todo it with something similar to this:
    Expr: "ToChar(TimeStamp(),'MM') + '/' + ToChar(TimeStamp(),'DD') + '/' + ToChar(TimeStamp(),'YYYY') + ' ' + ToChar(TimeStamp()+(1/24),'HH') + ':00:00'"
    as a pre-default value.

  • How to display the eror message in the iView

    Hi
    I want to check the user input in the client side and display an error message in the iView instead of displaying the error message as an alert
    it is ok when I tried to do it as an alert
    alert('ERROR MESSAGE');
    but the problem is how to display the error message as a text in the iView ...
    I wrote the below code..
    any one can see it and has any sugestion?
    Thanks
    =============
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <%
    String compid = "";
    String message = "";
    %>
    <hbj:content id="MyContent">
    <hbj:page title = "Selection Screen">
    <hbj:form id = "myForm">
    <br>
    <br>
    <br>
    <center>
    <H3>Benefits Statement </H3>
    <H4>Selection Screen</H4>
    <hbj:gridLayout
    id="FSSLayout"
    debugMode="False"
    width="40%"
    cellSpacing="5"
    >
    <hbj:gridLayoutCell
    rowIndex="1"
    columnIndex="1"
    width="10%"
    horizontalAlignment="LEFT"
    style="WildStyle"
    >
    <hbj:label
    id="label_inputPernr"
    required="TRUE"
    text="Personal Number:"
    design="LABEL"
    labelFor="inputPernr"
    />
    </hbj:gridLayoutCell>
    <hbj:gridLayoutCell
    rowIndex="1"
    columnIndex="2"
    width="40%"
    horizontalAlignment="LEFT"
    >
    <hbj:inputField id = "inputPernr"
    >
    <%
    compid=MyContent.getParamIdForComponent(inputPernr);
    %>
    </hbj:inputField>
    </hbj:gridLayoutCell>
    <hbj:gridLayoutCell
    rowIndex="10"
    columnIndex="1"
    width="40%"
    horizontalAlignment="CENTER"
    colSpan="2"
    >
    <hbj:button id = "myButton" text="Submit.." design="EMPHASIZED"
    tooltip="Click me to submit this form" onClick="ClickEvent" onClientClick="validRequired()">
    </hbj:button>
    </hbj:gridLayoutCell>
    </hbj:gridLayout>
    </center>
    <p font="Arial" size=20><%= message%></p>
    </hbj:form>
    <SCRIPT LANGUAGE="Javascript">
    function validRequired()
    var myvar = document.getElementById('<%=compid%>').value;
    var ivID='<%=componentRequest.getComponentContext().getContextName()%>';
    if (myvar = " ")
    message = "Enter Employee Number";
    ivuRefresh(ivID);
    htmlbevent.cancelSubmit=true;
    </SCRIPT>
    </hbj:page>
    </hbj:content>

    No problem, here is an example of some html code and javascript that you can adapt to your needs. You can display this standalone to see how it works.
    I hope this helps
    <html>
         <head>
              <script language="JavaScript">
                   function validateForm(){
                        if(document.getElementById("nameField").value == "")
                             document.getElementById("errormessage").innerHTML = "Please enter the Name";
                        else if(document.getElementById("ageField").value == "")
                             document.getElementById("errormessage").innerHTML = "Please enter the Age";
                        else if(document.getElementById("idField").value == "")
                             document.getElementById("errormessage").innerHTML = "Please enter the id";                         
                        else
                             document.getElementById("errormessage").innerHTML = "";
              </script>
         </head>
         <body>
              <table border="0" cellpadding="0" cellspacing="0">
                   <tr>
                     <td>Name</td>
                     <td><input type="input" id="nameField" name="nameField"></td>
                   </tr>
                   <tr>
                     <td>Age</td>
                     <td><input type="input" id="ageField" name="ageField"></td>
                   </tr>
                   <tr>
                     <td>Id</td>
                     <td><input type="input" id="idField" name="idField"></td>
                   </tr>
                   <tr><td><font color="red"><span id="errormessage"></span></font></td></tr>
                   <tr><td><input type="button" name="validate" onClick="validateForm()" value="Click to validate"/></td></tr>
              </table>
         </body>
    </html>

  • How to display the JSP output in the same page....

    im new to JSP..... can anyone tell me how to display the output of a particular JSP page in the same page itself...... if anyone could send a small sample code it will be very useful for me....
    thanks in advance
    regds
    Krish......

    Hi Robert -
    When you say you are writing a template-based Renderer, do you mean that you are creating a custom look and feel and replacing the header Renderer? If so, I'd recommend instead simply creating your own template (not template-based Renderer), and reference your template directly from your uiXML pages where you want to insert the timestamp.
    You'll probably want to write a method data provider which calls System.currentTime(), convert the result to a date, and then use Java's date formatting capabilities (see java.text.format.DateFormat) to produce a user presentable String that you can return from your data provider.
    For more info (and samples) on templates and data binding, see the "Templates and Data Binding" section of the "Includes and Templating in ADF UIX" help topic:
    http://tinyurl.com/5b7bf
    Andy

  • How to display the velocity template in browser

    Hi All,
    Am new to vm. Can anyone help me, how to display the content of .vm file in browser ?
    Am able to display the content of .vm file in console.
    Whether this is because of any path issues ?
    Thanks in Advance.

    Hi PKG,
    I think the easiest way to achive this, is to design your RenderListItem form like your ShowForm and restrict the number of items in your collection renderer to "1".
    So a list is rendererd with exactly one item.
    Kind Regards
    --Matthias

  • How to display the err msg in statusbar

    Hi friends,
        How to display the error msg (red color) in statusbar and other msg is green color in same report of the status bar .
    Plz help any one.
    Thanks in advance.

    Hi YUMKUMAR ,
    You can use the below code. 
    Create a message class : ZMSSG or with any other name and use the below code.
    IF SY-SUBRC  NE 0 .
        MESSAGE : E000(ZMSSG) WITH 'Data not available for this entry'.
      ENDIF .
    or
    IF SY-SUBRC NE 0 .
        MESSAGE : S000(ZMSSG) WITH 'Data not available for this entry'.
      ENDIF .
    Regards,
    Kittu
    Edited by: Kittu on Feb 1, 2010 7:51 AM

  • How to display the variable content in message?

    Hi anybody
    please let me know How to display the variable content in message?
    please send few lines of sample code to understand that
    thanks in advance

    Hi,
    Check out the link
    http://help.sap.com/saphelp_nw70/helpdata/en/2c/840b42202cce6ce10000000a155106/content.htm
    REPORT Y9020027 LINE-SIZE 130.    "Release 3.1G, 4.5A                  
    BREAK-POINT.
    MOVE: 'TESTREPORT for    "ASSIGN  FFeld+o(l)  TO  "        '     
            TO SY-TITLE.
          Declaration of variables    **********************
    FIELD-SYMBOLS <FS1>.
    DATA: FFELD8(8)   TYPE F VALUE '1022333'.   "Unusual: Explicit 8 bytes
    *DATA: ZFELD1(2)    TYPE N.            "Here slack bytes are (DW border)
                                         "necessary                      
                  "If you like computing error, please uncomment the above
    DATA: FFELDX(8)   TYPE F VALUE '7777777'.
    DATA: FFELDA(8)   TYPE F VALUE '7333213'.
    DATA: NFELDX(400) TYPE N.
    DATA: OFFX(4) TYPE I VALUE 160.
    DATA: LENX(4) TYPE I VALUE 8.
                  Main Section             *******************
        SKIP.
        WRITE: /5  'Example 1   **** inadmissible ASSIGN ***' COLOR 6.
        WRITE: /10 'Inadmissible ASSIGN: ''ASSIGN FFELD4+1(3) TO <FS1>'' '.
      ASSIGN FFELD4+1(3) TO <FS1>.
        ULINE.
        SKIP 2.
        SKIP.
    ASSIGN FFELD8+8(8) TO <FS1>.     "<-- Assigning of variable  FFELDX  !!
        BREAK-POINT.
        WRITE: / 'ASSIGN command with FFELD8, but FFELDX will be assigned'
                  COLOR 3.
        WRITE: /5 'Example 2'.
        PERFORM DISPLAY-FFELD USING FFELD8 'FFELD8'.
        WRITE: /10 'Content of   FFELDX      :', FFELDX.
        ULINE. SKIP 2.
        SKIP.
    ASSIGN FFELD8+16(8) TO <FS1>.    "<-- Assiging a few FFELDA to <FS1>  
        BREAK-POINT.
        WRITE: / 'ASSIGN with FFELD8, but instead FFELDA is assigned'
                  COLOR 3.
        WRITE: /5 'Example 3'.
        WRITE: /10 'Content of   FFELDA      :', FFELDA.
        PERFORM DISPLAY-FFELD USING FFELD8 'FFELD8'.
        WRITE: /10 'Content of   FFELDA      :', FFELDA.
        ULINE. SKIP 2.
    BREAK-POINT.
       DO 4 TIMES.
         ASSIGN FFELD8+OFFX(LENX) TO <FS1>.     "Zuordnung auf OFFX zu <FS1>
            WRITE: / 'ASSIGN command with FFELD8, es wird NFELDX zugeordnet'
                      COLOR 5.
             WRITE: /5 'Example 4', 'DO-Schleife Nr.:', SY-INDEX.
             PERFORM DISPLAY-FFELD USING FFELD8 'FFELD8'.
             WRITE: /10 'Content of NFELDX145(40)  :', NFELDX145(40).
             ULINE. SKIP 2.
             ADD 8 TO OFFX.
       ENDDO.
                   Subroutines             *******************
               Display of data fields and field symbols                  *
    FORM DISPLAY-FFELD USING FFELD FNAME.
    WRITE: /10 'Content of', FNAME, ':', FFELD.
    PERFORM FELDEIGENSCHAFTEN USING FFELD.
    WRITE: /10 'Content of <FS1> :', <FS1>.
    PERFORM FELDEIGENSCHAFTEN USING <FS1>.
    ADD   111    TO <FS1>.               "<-- Das Feldsybmol wird verwendet
    WRITE: /10 'ADD 111 TO <FS1>'.
    ULINE.
    WRITE: /10 'Content of', FNAME, 35 ':', FFELD.
    WRITE: /10 'Content of <FS1>',  35 ':', <FS1>.
    ENDFORM.
       Determination of field properties (only for information)          *
    FORM FELDEIGENSCHAFTEN USING ALLG.
    DATA: FLAENGE(2) TYPE N.
    DATA: FTYP(1) TYPE C.
    DATA: FOUT(2) TYPE N.
    DATA: FDEZ(2) TYPE N.
      ULINE.
      DESCRIBE FIELD ALLG LENGTH FLAENGE.
      WRITE: /10 'Field length  :', FLAENGE.
      DESCRIBE FIELD ALLG TYPE FTYP.
      WRITE: /10 'Field type    :', FTYP.
      DESCRIBE FIELD ALLG OUTPUT-LENGTH FOUT.
      WRITE: /10 'Output length :', FOUT.
      DESCRIBE FIELD ALLG DECIMALS FDEZ.
      WRITE: /10 'Decimals      :', FDEZ.
      SKIP 1.
    ENDFORM.
    END OF PROGRAM *************************************

Maybe you are looking for

  • Get Unix Process id from Form 6i

    Dear all, Does anyone know how can I get the Unix Process ID of the current session from Forms that run on client side ? Is the TOOL_ENV package help ?

  • Using Email to initiate a BPEL Process

    Hi All, We have a request to process a .csv file which comes as an attachment thru Mail. we are able to do the setup to invoke the BPEL Process as the mail is received. We want to know how to get attached file in BPEL Process to process it further. W

  • Gx630 and problem with dvd playback via hdmi to plasma

    I'm having problems playing a dvd from the gx630 while connected via HDMI to my plasma.  Without fail, the screen freezes up within 5 minutes of watching the movie.  I can watch a dvd on my laptop without a problem.  Any suggestions?

  • Underexposed LCD screen query

    Hi, I have just bought a used 5d and have a question that I hope someone may be able to help with.... I have an old manual focus lens with an EOS adapter that I have used on my other camera (450D) and everything works fine, but when I fit this lens t

  • How to access BO server using Enterprise COM SDK

    Hello, We were using "classic" ASP program(in IIS Web Server) to run reports from Crystal Reports,  now as part of our upgrade we should use Business Objects Enterprise server XI R 2 (all the reports from CR has been moved to BO) from our Webserver,