Website on data structures such as stacks and queues.

Hi,
I'm currently try to read up on data structures such as stacks, queues but don't quite understand how to implement that. Is there any useful links with example that I can read up from?
Thanks

Depends what you mean by "implement". If you want to use standard Java classes that are already written, and you want to know which to choose, then
http://java.sun.com/docs/books/tutorial/collections/
If you want to write your own, for some obscure reason, then read a book on data structures. Or try to write your own implementation of the Java collection classes.

Similar Messages

  • Help regarding Stacks and Queues.!!!!!!Please....

    I have a working program right now..But it lacks some things to be done..It already does the stacks and queues..But still it doesnt print the info on the desired output file outTwo.dat..Both the stacks and queues should be printed on it..Also it has to compute the total commission on categories 1 and 2...and put it again on the outTwo.dat..Any kind hearted people would want to help me here?Here's the assignment detail...Thank YOU!!!!
    Q2. Linked List
    a.     create a compile AStack class, and a AQueue class similar to the text
    b.     provide an application that will:
    �     instantiate an AStack object and an AQueue object
    �     create a property object for each data line read from the input file assign4.dat
    �     push it ti the stack if its is category 1 property; queue if its is category 2; ignore all others
    �     print a title called category 1 to an output file called outTwo.dat
    �     after printing a few blank lines to outTwo.dat, print a title called category 2 to outTwo.dat
    �     traverse the queue and print it to the same output file outTwo.dat
    �     print the total commission earned on this category of property to outTwo.dat
    Note that for this question you should also print out and submit outTwo.dat. Have Fun!
    //This is the program I have done so far....
    import java.io.*;
    import java.util.StringTokenizer;
    public class TestSQ {
         public static void readFileSQ(AStack s, AQueue q)
              try {
    FileReader inStream=new FileReader("assign4.dat");
    BufferedReader ins= new BufferedReader(inStream);
    FileWriter outStream=new FileWriter("outTwo.dat");
    PrintWriter outs= new PrintWriter(outStream);
    String line;
    int category;
    double price;
    String categoryString;
    String priceString;
    StringTokenizer st;
    while((line=ins.readLine())!=null) {
    st=new StringTokenizer(line," ");
    if(st.countTokens()==2){
    categoryString = st.nextToken();
    priceString = st.nextToken();
    try{
    category = Integer.parseInt(categoryString);
    price = Double.parseDouble(priceString);
    Property myProperty = new Property(category, price);
    myProperty.setCommissionRate();
    myProperty.getCommission();
         if(category==1)
    s.push(myProperty);
    outs.println(s.toString());
    if(category==2)
                             q.insert(myProperty);
                             outs.println(q.toString());
    }catch(NumberFormatException nfe){
    System.out.println("error while parsing Integer: "+categoryString+"/"+priceString);
    else
    System.out.println("invalid number of elements in line: " +st.countTokens());
    catch (IOException e) {
    System.out.println("i/o error:"+e.getMessage());
    e.printStackTrace();
         public static void showStack(AStack s){
              while(!s.isEmpty()){
                   Object line=s.pop();
                   System.out.println(line);
    public static void main(String args[])
         AStack stackOfProperty=new AStack();
         AQueue queueOfProperty=new AQueue();
         readFileSQ(stackOfProperty,queueOfProperty);
         showStack(stackOfProperty);
         System.out.println();
         System.out.println(queueOfProperty.toString());
    }

    import java.io.*;
    import java.util.StringTokenizer;
    public class TestSQ {
         public static void readFileSQ(AStack s, AQueue q)
              try {
                FileReader inStream=new FileReader("assign4.dat");
                BufferedReader ins= new BufferedReader(inStream);
                FileWriter outStream=new FileWriter("outTwo.dat");
                PrintWriter outs= new PrintWriter(outStream);
                String line;
                int category;
                double price;
                String categoryString;
                String priceString;
                StringTokenizer st;
                 while((line=ins.readLine())!=null) {
                    st=new StringTokenizer(line," ");
                    if(st.countTokens()==2){
                        categoryString = st.nextToken();
                        priceString = st.nextToken();
                        try{
                            category = Integer.parseInt(categoryString);
                            price = Double.parseDouble(priceString);
                            Property myProperty = new Property(category, price);
                            myProperty.setCommissionRate();
                            myProperty.getCommission();
                                if(category==1)
                            s.push(myProperty);
                          //  outs.println(s.toString());
                            else if(category==2)
                                 q.insert(myProperty);
                                 outs.println(q.toString());
                        }catch(NumberFormatException nfe){
                            System.out.println("error while parsing Integer: "+categoryString+"/"+priceString);
                    else
                        System.out.println("invalid number of elements in line: " +st.countTokens());
                outs.close();
                ins.close();
            catch (IOException e) {
                System.out.println("i/o error:"+e.getMessage());
                e.printStackTrace();
         public static void showStack(AStack s){
              while(!s.isEmpty()){
                   Object line=s.pop();
                   System.out.println(line);
        public static void main(String args[])
             AStack stackOfProperty=new AStack();
             AQueue queueOfProperty=new AQueue();
             readFileSQ(stackOfProperty,queueOfProperty);
             showStack(stackOfProperty);
             System.out.println();
             System.out.println(queueOfProperty.toString());
       }//This is the updated version of my program..Now the ouput file works now, but then it shows different ouput..Thats only for the queue.I dont know about the stack..Tnx for looking...

  • Stacks and Queues

    Hello, I am new to Java and am working out an assignment. I need to manipulate some stacks and queues in various ways.
    I need to reverse a stack in three different ways:
    1. using two additional stacks.
    2. using one additional queue.
    3. using one additional stack and some additional non-array variables.
    I think I have ways to do 1 and 2 but I'm a bit confused about 3.
    For 1, I would pop the the elements off of the full stack A, and push them onto B. Then pop them from B and push them to C. Then pop them from C and push them to A, thus reversing the order.
    For 2, simply pop the elements from the stack and enqueue them in the queue. Then dequeue them and push them back to the stack.
    For 3, not really sure where to start or how? I could think of how to do it with an array but I'm drawing a blank on this. I don't want anyone to write the code for me just maybe point me in the right direction?
    The assignment then carries on to sorting in ascending order using a stack and then just using non-array variables. I feel like if I can figure out number 3 above the rest will be along similar lines.
    Any help is greatly appreciated.

    The restrictions might be nudging towards a constant-storage algorithm. In which case, try the following.
    You can move any element to the top of the stack using a stack and non-array variables. Take the 4th element for example:
    Pop 3 elements from the stack and push onto the other.
    Pop the next element and store in a variable.
    Pop the 3 elements from the second stack and push back on the first.
    Push the value from the variable onto the first stack.
    This can be used for reversing and sorting the stack.

  • Stack and queue problem

    hi i am trying to change infix expression to postfix and also the opposite, like
    ((a+b)*(a-c*d)/(b+d*e)) to ab+acb*-bde+/
    using stack and queue
    I am so confuse

    Hello,
    See this URL :
    http://www24.brinkster.com/premshree/perl
    You will find the algorithms here.
    Here is a Perl version :
    #     Script:          infix-postfix.pl
    #     Author:          Premshree Pillai
    #     Description:     Using this script you can :
    #               - Convert an Infix expression to Postfix
    #               - Convert a Postfix expression to Infix
    #               - Evaluate a Postfix expression
    #               - Evaluate an Infix expression
    #     Web:          http://www.qiksearch.com
    #     Created:     23/09/02 (dd/mm/yy)
    #     � 2002 Premshree Pillai. All rights reserved.
    sub isOperand
         ($who)=@_;
         if((!isOperator($who)) && ($who ne "(") && ($who ne ")"))
              return 1;
         else
              return;
    sub isOperator
         ($who)=@_;
         if(($who eq "+") || ($who eq "-") || ($who eq "*") || ($who eq "/") || ($who eq "^"))
              return 1;
         else
              return;
    sub topStack
         (@arr)=@_;
         my $arr_len=@arr;
         return($arr[$arr_len-1]);
    sub isEmpty
         (@arr)=@_;
         my $arr_len=@arr;
         if(($arr_len)==0)
              return 1;
         else
              return;
    sub prcd
         ($who)=@_;
         my $retVal;
         if($who eq "^")
              $retVal="5";
         elsif(($who eq "*") || ($who eq "/"))
              $retVal="4";
         elsif(($who eq "+") || ($who eq "-"))
              $retVal="3";
         elsif($who eq "(")
              $retVal="2";
         else
              $retVal="1";
         return($retVal);
    sub genArr
         ($who)=@_;
         my @whoArr;
         for($i=0; $i<length($who); $i++)
              $whoArr[$i]=substr($who,$i,1);
         return(@whoArr);
    sub InfixToPostfix
         ($infixStr)=@_;
         my @infixArr=genArr($infixStr);
         my @postfixArr;
         my @stackArr;
         my $postfixPtr=0;
         for($i=0; $i<length($infixStr); $i++)
              if(isOperand($infixArr[$i]))
                   $postfixArr[$postfixPtr]=$infixArr[$i];
                   $postfixPtr++;
              if(isOperator($infixArr[$i]))
                   if($infixArr[$i] ne "^")
                        while((!isEmpty(@stackArr)) && (prcd($infixArr[$i])<=prcd(topStack(@stackArr))))
                             $postfixArr[$postfixPtr]=topStack(@stackArr);
                             pop(@stackArr);
                             $postfixPtr++;
                   else
                        while((!isEmpty(@stackArr)) && (prcd($infixArr[$i])<prcd(topStack(@stackArr))))
                             $postfixArr[$postfixPtr]=topStack(@stackArr);
                             pop(@stackArr);
                             $postfixPtr++;
                   push(@stackArr,$infixArr[$i]);
              if($infixArr[$i] eq "(")
                   push(@stackArr,$infixArr[$i])
              if($infixArr[$i] eq ")")
                   while(topStack(@stackArr) ne "(")
                        $postfixArr[$postfixPtr]=pop(@stackArr);
                        $postfixPtr++;
                   pop(@stackArr);
         while(!isEmpty(@stackArr))
              if(topStack(@stackArr) eq "(")
                   pop(@stackArr)
              else
                   $temp=@postfixArr;
                   $postfixArr[$temp]=pop(@stackArr);
         return(@postfixArr);
    sub PostfixToInfix
         ($postfixStr)=@_;
         my @stackArr;
         my @postfixArr=genArr($postfixStr);
         for($i=0; $i<length($postfixStr); $i++)
              if(isOperand($postfixArr[$i]))
                   push(@stackArr,$postfixArr[$i]);
              else
                   $temp=topStack(@stackArr);
                   pop(@stackArr);
                   $pushVal=topStack(@stackArr).$postfixArr[$i].$temp;
                   pop(@stackArr);
                   push(@stackArr,$pushVal);
         return((@stackArr));
    sub PostfixEval
         ($postfixStr)=@_;
         my @stackArr;
         my @postfixArr=genArr($postfixStr);
         for($i=0; $i<length($postfixStr); $i++)
              if(isOperand($postfixArr[$i]))
                   push(@stackArr,$postfixArr[$i]);
              else
                   $temp=topStack(@stackArr);
                   pop(@stackArr);
                   $pushVal=PostfixSubEval(topStack(@stackArr),$temp,$postfixArr[$i]);
                   pop(@stackArr);
                   push(@stackArr,$pushVal);
         return(topStack(@stackArr));
    sub PostfixSubEval
         ($num1,$num2,$sym)=@_;
         my $returnVal;
         if($sym eq "+")
              $returnVal=$num1+$num2;
         if($sym eq "-")
              $returnVal=$num1-$num2;
         if($sym eq "*")
              $returnVal=$num1*$num2;
         if($sym eq "/")
              $returnVal=$num1/$num2;
         if($sym eq "^")
              $returnVal=$num1**$num2;
         return($returnVal);
    sub joinArr
         (@who)=@_;
         my $who_len=@who;
         my $retVal;
         for($i=0; $i<$who_len; $i++)
              $retVal.=$who[$i];
         return $retVal;
    sub evalInfix
         ($exp)=@_;
         return PostfixEval(joinArr(InfixToPostfix($exp)));
    sub init
         my $def_exit="\n\tThank you for using this Program!\n\tFor more scripts visit http://www.qiksearch.com\n";
         printf "\n\tInfix - Postfix\n";
         printf "\n\tMenu";
         printf "\n\t(0) Convert an Infix Expression to Postfix Expression";
         printf "\n\t(1) Convert a Postfix Expression to Infix Expression";
         printf "\n\t(2) Evaluate a Postifx Expression";
         printf "\n\t(3) Evaluate an Infix Expression";
         printf "\n\t(4) Exit this Program";
         printf "\n\t(5) About this Program\n";
         printf "\n\tWhat do you want to do? (0/1/2/3/4/5) ";
         $get=<STDIN>;
         chomp $get;
         if(!(($get eq "0") || ($get eq "1") || ($get eq "2") || ($get eq "3") || ($get eq "4") || ($get eq "5")))
              printf "\n\t'$get' is an illegal character.\n\tYou must enter 0/1/2/3/4/5.";
         if(($get ne "4") && ($get ne "5") && (($get eq "0") || ($get eq "1") || ($get eq "2") || ($get eq "3")))
              printf "\n\tEnter String : ";
              $getStr=<STDIN>;
              chomp $getStr;
         if($get eq "0")
              printf "\tPostfix String : ";
              print InfixToPostfix($getStr);
         if($get eq "1")
              printf "\tInfix String : ";
              print PostfixToInfix($getStr);
         if($get eq "2")
              printf "\tPostfix Eval : ";
              print PostfixEval($getStr);
         if($get eq "3")
              printf "\tExpression Eval : ";
              print evalInfix($getStr);
         if($get eq "4")
              printf $def_exit;
              exit 0;
         if($get eq "5")
              printf "\n\t======================================================";
              printf "\n\t\tInfix-Postfix Script (written in Perl)";
              printf "\n\t\t(C) 2002 Premshree Pillai";
              printf "\n\t\tWeb : http://www.qiksearch.com";
              printf "\n\t======================================================\n";
              printf "\n\tUsing this program, you can : ";
              printf "\n\t- Convert an Infix Expression to Postfix Expression.";
              printf "\n\t Eg : 1+(2*3)^2 converts to 123*2^+";
              printf "\n\t- Convert a Postfix Expression to Infix Expression.";
              printf "\n\t Eg : 123*+ converts to 1+2*3";
              printf "\n\t- Evaluate a Postfix Expression";
              printf "\n\t Eg : 37+53-2^/ evaluates to 2.5";
              printf "\n\t- Evaluate an Infix Expression";
              printf "\n\t Eg : (5+(4*3-1))/4 evaluates to 4";
              printf "\n\n\tYou can find the algorithms used in this Program at : ";
              printf "\n\t-http://www.qiksearch.com/articles/cs/infix-postfix/index.htm";
              printf "\n\t-http://www.qiksearch.com/articles/cs/postfix-evaluation/index.htm";
              printf "\n\n\tYou can find a JavaScript implementation of 'Infix-Postfix' at : ";
              printf "\n\t-http://www.qiksearch.com/javascripts/infix-postfix.htm";
         printf "\n\n\tDo you want to continue? (y/n) ";
         my $cont=<STDIN>;
         chomp $cont;
         if($cont eq "y")
              init();
         else
              printf $def_exit;
              exit 0;
    init;

  • Data structure for simulation of message queue

    Hello,
    I have undertaken a project of simulating the point to point and publish/subscribe protocols of message queueing. This whole project would be done just in Java. There won't be any system level programming. Which data structure in Java would be the most efficient one for the message queue?

    Hello,
    I have undertaken a project of simulating the point to point and publish/subscribe protocols of message queueing. This whole project would be done just in Java. There won't be any system level programming. Which data structure in Java would be the most efficient one for the message queue?

  • How to return a data structure such as an array from PJC to a Form

    Hello,
    I am trying to find a way to return an array of data from PJC.
    I know how to do it one cell at a time, but it is a very slow way to develope
    a program.
    Is there any way to return an array of data from PJC with a single method call?
    This seems to be impossible, because the GET_CUSTOM_PROPERTY only returns
    strings.
    Best regards,
    Jarkko Levasma

    if you mean resultSet to pl/sql datatype - yes appears to be impossible - I worked on it for a while

  • Iterative maze generation with a stack and queue

    I searched the forums, and a couple of hits were interesting, particularly http://forum.java.sun.com/thread.jsp?forum=54&thread=174337 (the mazeworks site is very very cool), but they all centered on using a recursive method to create a maze. Well, my recursive maze generation is fine; it seems to me that recursion lends itself quite well to this particular form of abuse, so well in fact that I am having trouble wrapping my head around an iterative approach. :) I need to create a maze iteratively, using a stack if specified by the user, else a queue. I can vaguely see how a stack simulates recursion but conceptualization of the queue in particular is making my hair hurt. So I was just wondering if anyone had any thoughts or pointers that they wouldn't mind explaining to me to help me with this project. Thanks kindly.
    Maduin

    Stacks (i.e. a first in, last out data storage structure) are very, very closely tied to recursive calls - after all, the only reason that the recursion works at all is because the language is placing the current state of the method on a stack before it calls the method again.
    As for using queue's to implement the same type of thing, are you allowed to use a dequeue (double ended queue)? If so, dequeue's are a pretty common way of implementing a stack - they allow you to implement both FILO and FIFO (first in, first out) structures by whether you pull the stored item from the head or tail of the dequeue.
    If you are talking about a FIFO, then that's a different story - let us know!
    - K
    PS - recursion is an odd topic to get your head around - keep working at it! The biggest thing to realize is that all recursive routines must have SOME way to exit them without continuing the recursion. The design of a recursive call, then, is generally easiest to do when implemented by answering the following question: "Under what condition should the recursion stop?", and then building the routine backwards from there.

  • Help with java coding involving stacks and queues.

    I was wondering if anyone can help with tips on what to fill in for the coding.
    My project is to creating a word processor by the process of 2 stacks. The methods are given, but I'm not really sure what goes in them. So I was wonder if anyone can answer this for me, or give tips that would be great thanks.
    Example Code, similar to what were suppose to do, but instead it's CHARACTER stacks rather than String.
    [http://www.cs.jhu.edu/~jason/226/hw3/source/EditableString.java]

    /** Stack of Characters to the left of the cursor; the ones
       * near the top of the stack are closest to the cursor.
      private Stack left;
      /** Stack of Characters to the right of the cursor; the ones
       * near the top of the stack are closest to the cursor.
      private Stack right;Do you know how a stack works?
    No - Google it
    Yes - Continue on with this post
    /** Another constructor.
       * @param left The text to the left of the cursor.
       * @param right The text to the right of the cursor.
      public EditableString(String left, String right) {
        // fill this in
      }Do you know how to read?
    No - How did you answer this question then?
    Yes - Then why can't you read the comments above each method. Is it really that hard to understand?
    Mel

  • Stack and Queue

    Where do we use them?So far i haven't come across any program which uses them.

    You could use a stack for a calculator application, or a queue for a resource management application.

  • Linked List, Stacks and Other Data Structures in Objective-C 2.0

    I've checked a little throughout documentation that Apple provides for the different frameworks in order to determine if there were ready-made classes for data structures such as linked lists, stacks and so forth but there don't appear to be any available? Is this correct?

    NSArray and NSDictionary are the multi-purpose built-in aggregate types. If you need something else then you can use STL or roll your own.

  • Complex data structure.

    Hi,
    This is a design issue that I have run into many times and I was wondering how you all solve it. When using complex data structures (such as array of clusters, or clusters containg arrays and/or other clusters), I have found that there are many situations where you need to wire either an "empty" stucture or the type of the structure as an input. For example, when building up the data structure, I often use shift registers, and need an empty data structure to initialize the shift register. Also when bundling a cluster by name you need the type of the cluster. My question is - what do you use in these situations? Of course, I always typedef my complex structures, and I know that there is a default value for them, because other language featu
    res depend on there being a default. Is there anyway to get the default value for a typedef? Not seeing one, I have taken to creating a Global or Dummy VI for each typedef that returns a default data structure, which is what I use in all these situations. What other approaches have you seen?

    > of the cluster. My question is - what do you use in these situations?
    > Of course, I always typedef my complex structures, and I know that
    > there is a default value for them, because other language features
    > depend on there being a default. Is there anyway to get the default
    > value for a typedef? Not seeing one, I have taken to creating a Global
    > or Dummy VI for each typedef that returns a default data structure,
    > which is what I use in all these situations. What other approaches
    > have you seen?
    You can right click on a wire or terminal and create a constant for the
    type already there. This will sometimes fool you if you are wanting the
    input to a shift register since the types flow downstream and you want
    upstream. Just click somewhere whe
    re the type is known, create the
    const and move it where you want it.
    The BIG downside to this is that typedef constants tend to be BIG. My
    favorite solution is to make a subVI that returns the default for the
    typedef. Put it in user.lib and it is readily accessible. You can
    think of it as a constructor for your datatype, if you want. In fact
    you can make several of these or parameterize it to return different
    flavors. Being the size of all other icons, it fits nicely into the
    diagram and adapts to typedef changes.
    Greg McKaskle

  • Data Structure Needed

    *** PLEASE DO NOT REPLY TO THIS POSTING UNLESS
    *** YOU KNOW EXACTLY WHAT I AM TALKING ABOUT
    *** AND HAVE SOLUTION AT THE READY.
    *** NO SWING TREE FYIs PLEASE...doesn't apply.
    *** NO UI JAVASCRIPTS .. I HAVE THOSE.
    I need a properly constructed multiway
    (m-way, general, n-ary, etc.) data structure
    implementation that uses non-ui
    dependent/associated classes. This is know as the
    first child/next sibling data structure used in
    Filesystems (similiar to a BTree).
    I am using many delimited strings, similiar to a
    directory/file structure path but the string is a
    software project hierarchy.
    [a string is structured like this]
    root|branch|...|branch|leaf
    [Process]
    1) the strings are fetched from DB by servlet.
    2) servlet feeds strings into data structure
    to eliminate duplicates and place in proper location.
    3) servlet uses contents of data structure to
    construct links that are coupled with the infamous
    ui-tree script.
    If you know your data structures and have an implementation
    that won't take me 6 days to modify for it to work I would
    appreciate your assistance. I am creating on my own as we
    speak but one from a more experienced java programmer would
    be better.
    Thank You,
    Kevin

    Sounds like one hell of a frustrated programmer over there - all those capitals an'all..
    If I understand you correctly, I don't think you'd take six days to implement this; just split your string by the separator;
    String[] split(String path, char sep, char esc) {
      String[] result = new String[0];
      int o = 0;
      int i; for (i=0; i<path.length(); ++i) {
        char c = path.charAt(i);
        if (c == esc) {
          ++i;
          continue;
        if (c == sep) {
          String substring = path.substring(o, i);
          String[] newresult = new String[result.length+1];
          System.arraycopy(result, 0, newresult, 0, result.length);
          newresult[result.length] = substring;
          result = newresult;
          o = i+1;
    }Then have a java.util.Hashtable as root, with all names in it pointers to either more Hashtables (nodes), or Strings (leaves). If it really does not get anymore complex than that (data associated with leaves, for example), you don't really have to use anything more complex than 'instanceof' here.
    Then start looping over all your String[] split paths, retrieve all nodes, if it's a String and you have a child for it, then convert it to a Hashtable, it it's a Hashtable trod along, if it isn't there create a String (unless you know you have an extra child, in which case you create a Hashtable).
    When you're ready to retrieve, just enumerate your root Hashtable, casting to String all the keys, examining all the values; if they are Hashtable, then recurse. If they're Strings, do your Thing (TM).

  • Difference between AQ$TableName and Queue TableName

    Our BPEL process is listening to Business event from Oracle ebiz. Noticed the following
    BE raised -> Message available in wf_deferred (queue table name) -> Message available in wf_bpel_qtab (queue table name) -> BPEL instance invoked.
    After the above process ,noticed that the record state in wf_bpel_qtab is 0 and there is no value in dequeue time. On the other hand, in AQ$WF_BPEL_QTAB view, for the same message the state is Processed and dequeue time is populated.
    1. Why there is difference in data AQ$TableName and queue TableName
    2. Is there any process, to make sure that the data in both AQ$TableName and queue TableName are in sync
    3. When the data will be deleted from queue TableName ? Currently, the retention value of the Queue is 0.
    Thanks.

    Hi Paul,
    After cloning Following is the queue status from the database.
    SQL> select OWNER, NAME, ENQUEUE_ENABLED, DEQUEUE_ENABLED
    from DBA_QUEUES where NAME like 'WF%' 2 ;
    OWNER NAME ENQUEUE DEQUEUE
    APPLSYS WF_INBOUND_QUEUE YES YES
    APPLSYS WF_OUTBOUND_QUEUE YES YES
    APPLSYS WF_REPLAY_OUT NO NO
    APPLSYS WF_ERROR NO NO
    APPLSYS WF_REPLAY_IN NO NO
    APPLSYS WF_OUT NO NO
    APPLSYS WF_DEFERRED_QUEUE_M YES YES
    APPLSYS WF_WS_JMS_OUT YES YES
    APPLSYS WF_JMS_OUT YES YES
    APPLSYS WF_WS_JMS_IN YES YES
    APPLSYS WF_JMS_IN YES YES
    OWNER NAME ENQUEUE DEQUEUE
    APPLSYS WF_SMTP_O_1_QUEUE YES YES
    APPLSYS WF_JAVA_ERROR YES YES
    APPLSYS WF_JAVA_DEFERRED YES YES
    APPLSYS WF_WS_SAMPLE YES YES
    APPLSYS WF_NOTIFICATION_IN YES YES
    APPLSYS WF_JMS_JMS_OUT YES YES
    APPLSYS WF_CONTROL YES YES
    APPLSYS WF_IN NO NO
    APPLSYS WF_NOTIFICATION_OUT YES YES
    APPLSYS WF_DEFERRED NO NO
    21 rows selected.
    I tried to make it to YES but got the following error.
    SQL> begin
    2 dbms_aqadm.start_queue(queue_name => 'WF_REPLAY_OUT');
    3 end;
    4 /
    begin
    ERROR at line 1:
    ORA-24003: Queue table index APPLSYS.AQ$_WF_REPLAY_OUT_I inconsistent with
    queue table APPLSYS.WF_REPLAY_OUT
    ORA-06512: at "SYS.DBMS_AQADM_SYS", line 5086
    ORA-06512: at "SYS.DBMS_AQADM", line 217
    ORA-06512: at line 2
    In our source all are YES.
    How can we make that queue to YES the we can go ahead applying that patch. Please advice....

  • Relationship between Dynamic Memory Heap and Heap Data Structure

    This question is not strictly related to Java, but rather to programming in general, and I tend to get better answers from this community than any where else.
    Somehow, my school and industry experience have somehow not given me the opportunity to explore and understand heaps (the data structure), so I'm investigating them now, and in particular, I've been looking at applications. I know they can be used for priority queues, heap sorts, and shortest path searches. However, I would have thought that, obviously, there must be some sort of relationship between the heap data structure, and the dynamic memory heap. Otherwise, I can think of no good reason why the dynamic memory heap would be named "heap". Surprisingly, after searching the web for 90 minutes or so, I've seen vague references, but nothing conclusive (trouble seems to be that it's hard to get Google to understand that I'm using the word "heap" in two different contexts, and similarly, it would not likely understand that web authors would use the word in two different contexts).
    The Java Virtual Machine Spec is silent on the subject, as "The Java virtual machine assumes no particular type of automatic storage management system, and the storage management technique may be chosen according to the implementor's system requirements."
    I've seen things like:
    [of dynamic memory] "All the blocks of a particular size are kept in a sorted linked list or tree (I extrapolate that sorted tree could imply heap)"
    [of dynamic memory] "The free and reserved areas of memory are maintained in a data structure similar to binary trees called a heap"
    [of dynamic memory] "This is not related to the heap data structure"
    [of dynamic memory] "Not to be confused with the data structure known as a "heap"
    [of data structure] "Not to be confused with the dynamic memory pool, often known as TheHeap"
    At this point, I've come to surmise that some (but not all) memory management algorithms use heaps to track which (pages? blocks? bytes?) of memory are used, and which are not. However, the point of a heap is to store data so that the max (or min) key is at the root of the heap. But we might want to allocate memory of different sizes at different times, so it wouldn't make sense to key on the amount of available memory in a particular region of the free store.
    I must assume then that there would be a different heap maintained for each size of memory block that can be allocated, and the key must have something to do with the attractiveness of the particular memory block in the heap (perhaps the lowest address, resulting, hopefully, in growing the free store space less often, leaving more space for the stack to grow, or perhaps keyed based on the fragmentation, to hopefully result in less fragmentation, and therefore more efficient use of the memory space, or perhaps based on page boundaries, keeping as much data in the same page as possible, etc).
    So at this point, I have a few questions I've been unable to resolve completely:
    1. Am I correct that the heap was so named because (perhaps at one point in time), a heap is/was commonly used to track the available memory in the free store?
    2. If so, would it be correct that there would be a heap per standard block size?
    3. Also, at what level of granularity would a heap typically be used (memory page, memory blocks, individual words (4-bytes))?
    4. What would be the most likely property one would use as a key. That is, what makes the root item on the heap ideal?
    5. Would a industrial strength system like the jvm use a (perhaps modified or tuned) heap for this sort of task, or would this typically be too naive for an real world solution today?
    Any insight would be awesome!
    Thanks,
    A.

    jschell wrote:
    I think you are not only mixing terms but domains.
    For starters the OS allocs memory. Applications, regardless of language, request memory from the OS and use it in various ways.
    There are many variations of the term "heap" like the following.
    [http://en.wikipedia.org/wiki/Heap_(data_structure)]
    [http://en.wikipedia.org/wiki/Dynamic_memory_allocation]
    A java VM will request memory from the OS (from a 'heap') and use it in its application 'heap' (C/C++) and then create the Java 'heap'. There can be variations of that along the way that can and likely will include variations of how each heap is used, potentially code that creates its own heap, and potentially other allocators which use something which is not a heap.This last part, I find a bit confusing. By "use something which is not a heap", do you mean the heap data structure, or the dynamic memory pool meaning of heap? If the former, then you would be implying that it would be common for a heap data structure to be used to manage the heap dynamic memory pool. If the latter, what would this "something which is not a heap" be? The best definition of "heap" I've found simply states that it is a pool of memory that can be dynamically allocated. If there is some other way of allocating dynamic memory, then it would suggest that the previous definition of "heap" is incomplete.
    >
    So to terms.
    1. Am I correct that the heap was so named because (perhaps at one point in time), a heap is/was commonly used to track the available memory in the free store?Which 'heap'? The VM one? It is probably named that because the implementors of the Sun VM were familar with how C++ and Smalltalk allocated memory.Okay, but that begs the question, was the heap in C++ and/or Smalltalk so named for the above queried reason?
    >
    2. If so, would it be correct that there would be a heap per standard block size?Not sure what you are referring to but probably a detail of the implementation. And since there are different levels the question doesn't mean much.
    However OS allocations are always by block if that helps. After that it requires making the question much, much more specific.
    3. Also, at what level of granularity would a heap typically be used (memory page, memory blocks, individual words (4-bytes))?Again not specific enough. A typical standard implementation of heap could not be at the word level. And it is unlikely, but not impossible, that variations would support word size allocations.
    The VM heap might use word boundaries (but not size), where the application heap certainly does (word boundary.)My understanding of it is that the application would request blocks from the OS, and then something like malloc would manage the memory within the allocated blocks. malloc (or whatever equivalent Java uses) would have to keep track of the memory it has allocated somehow, and I would think it would have to do this at the word level, since it's most commonly going to allocate memory at the word level to be references to other objects, etc.
    So I guess my question here would really be, if the dynamic memory heap is so named because there has been a memory management strategy that relied upon a heap data structure (which I've found no proof, but have found some suggestive literature), then would that probably have applied at the OS Page Fault level, tracking allocated blocks, or would that have applied at the malloc level, allocating individual words as necessary?
    >
    4. What would be the most likely property one would use as a key. That is, what makes the root item on the heap ideal?"Key" is not a term that will apply in this discussion.
    You appear to be referring to strategies for effective allocation of memory such as allocations from different regions by size comparison.
    It is possible that all levels might use such an allocator. General purpose applications do not sort allocations though (as per your one reference that mentions 'key'.) Sorry, I got the term "key" from an article I read regarding heaps, that indicates that a "key" is used to sort the elements, which I guess would be a more generalized way to make a heap than assuming a natural ordering on the elements in the heap. I'm not sure if the terminology is standard.
    >
    5. Would a industrial strength system like the jvm use a (perhaps modified or tuned) heap for this sort of task, or would this typically be too naive for an real world solution today?Again too indefinite. The Sun VM uses a rather complicated allocator, the model for which originated after years of proceeding research certainly in Smalltalk and in Lisp as well, both commercially and academically.
    I am sure the default is rules driven either explicitly or implicitly as well. So it is self tuning.
    There are command line options that allow you to change how it works as well.I guess perhaps I could attempt to clarify my initial question a bit.
    There is a 1:1 correspondence between the runtime stack, and a stack data structure. That is, when you call a function, it pushes a stack frame onto the runtime stack. When you return from a function, it pops a stack frame from the runtime stack. This is almost certainly the reasons the runtime stack is named as it is.
    The question is, is there or has there ever been a 1:1 correspondence between some aspect of the dynamic memory heap or how it is managed, and a heap data structure? If so, it would explain the name, but I'm a bit puzzled as to how a heap data structure would be of assistance in creating or managing the dynamic memory heap. If not, on the other hand, then does anybody know where the name "heap" came from, as it applies to the dynamic memory pool?
    A.

  • Looking for suitable and robust data structure?

    I have an application where i have to give user an option to correlate the
    response returned by a method call with other methods arguments.
    I have provided a jtree struture where user can see methods and their
    responses and can correlate them by selecting appropriate arguments
    where these values could be used.
    I used a data structure to store such relations like
    A hashmap where every key is a unique number representing method number
    and value ia a matrix.
    In each matrix, the first element of every row would be the Response object and
    all remaining elments in the row would be Argument objects. :)
    Now maybe someone would ask, for every method there is always only one return type
    then why such a matrix with Reponse object as first element of each row.
    The reason is that i gave user an option to not only relate response as a whole Object to
    different arguments of different methods but user can select a field of this response object if this
    is a complex type or user can select any element if the response is a Collection object to relate
    with arguments.
    I am not sure whether this structure is more appropriate or i can use more robust
    and memory efficient structure.
    Please give me your useful suggestions.

    J2EER wrote:
    I have an application where i have to give user an option to correlate the
    response returned by a method call with other methods arguments.I really don't understand you.
    I have provided a jtree struture where user can see methods and their
    responses and can correlate them by selecting appropriate arguments
    where these values could be used.Huh?
    I used a data structure to store such relations likeErr, what happened to the rest of your sentence? Or is the next part the rest of it?
    A hashmap where every key is a unique number representing method number
    and value ia a matrix.Where does this matrix come from? In my book, a matrix is a 2 dimensional structure. What do you mean by it?
    In each matrix, the first element of every row would be the Response object and
    all remaining elments in the row would be Argument objects. :)
    Now maybe someone would ask, for every method there is always only one return type
    then why such a matrix with Reponse object as first element of each row.You're still talking about methods? If so, don't all methods have just one return type?
    The reason is that i gave user an option to not only relate response as a whole Object to
    different arguments of different methods but user can select a field of this response object if this
    is a complex type or user can select any element if the response is a Collection object to relate
    with arguments.
    I am not sure whether this structure is more appropriate or i can use more robust
    and memory efficient structure.
    Please give me your useful suggestions.Perhaps you could give a more detailed explanation and more importantly, provide some examples of what you mean.

Maybe you are looking for

  • Understanding of DIR API

    Hi All, It is really a good experience to implement/use of DIR API concept in PI 7.0. With the help of the enhanced feature I created 80 File channels with all mandatory parameters in less than 30 seconds. But still I'm have not came across any DIR A

  • Integrating Sun Java Directory Server with Sun Java Application Server 7

    Hi, My basic goal is to implement Single Sign On within the network i,e if the user is inside the company's network and tries to access any application, then he should not be required for Username/password again becuase he is in the network. My quest

  • Default TAB selection

    Hi, Can any one let me know how to specify the default TAB that needs to be selected when the query is executed. iam also looking how to display Texts under the TAB. I have created the TABS using the JAVA Script that been mentioned in one of the link

  • Please help with file reading component

    i am currently writing a program in which i need to have a JTable which displays data from a text file which can be selected from an option via a JList. I can get the info from the file into the JTable but for some reason which i can't figure out! th

  • E65I GPS navigation

    Hi, Would anyone show me how to setup and get GPS of Naviation my phone (E65I), it's working please. When I set up on Navigation the erro pop up: "No bluetooth devices found. Try again? I did pressing yes. But the problem still exist. Many thanks. Re