Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32
  1. #11

    Default Re: tabang in Java. tabang!


    Quote Originally Posted by jairoh_ View Post
    sa akong nasabtan kunohay, pananglitan 5 ang length sa input. and then x is 0, nya 0 is less than 5 man, so mag.loop cya 5 times ra. hantod maabot sa 4 which is true kai 4 is less than 5 man. wa ko kasabot sa imong ipasabot nako nga it'll double the loop. hehehe. sorry noob pa tawn ta.
    what is mean is that the .length() method has a loop inside it in which every increment sa i++ mo loop pud na cya number of times depende sa size/length sa string....

    example
    for (int i = 0; i < input.length(); i++)

    lets say we input {[()]}
    so input.length() = 6

    inside the length() method, naa dha nag loop nga mag ihap sa characters which starts 1 to 6.

    and if ato cya gamiton sa imong loop
    for (int i = 0; i < mag loop 1 to 6; i++)
    for (int i = 1; i < mag loop 1 to 6; i++)
    for (int i = 2; i < mag loop 1 to 6; i++)
    for (int i = 3; i < mag loop 1 to 6; i++)
    for (int i = 4; i < mag loop 1 to 6; i++)
    for (int i = 5; i < mag loop 1 to 6; i++)

    nahulog nga naa kay inner loop every increment sa variable (e.g. i++)
    gets mo?

  2. #12
    Elite Member
    Join Date
    May 2011
    Gender
    Male
    Posts
    1,465

    Default Re: tabang in Java. tabang!

    ah mao diay. hehehe. pero wa raman kaha nai problema? kai same output raman japon?

  3. #13

    Default Re: tabang in Java. tabang!

    ok ra man.....pero at least karon start naka optimize sa imo codes kay sa industry if mag work naka as a developer, dapat jud optimized imo codes youre dealing with thousands or millions of items or collections or lists like retrieving multiple data sa database...

    maka balo ra ka ana later on
    Quote Originally Posted by jairoh_ View Post
    ah mao diay. hehehe. pero wa raman kaha nai problema? kai same output raman japon?

  4. #14
    Elite Member
    Join Date
    May 2011
    Gender
    Male
    Posts
    1,465

    Default Re: tabang in Java. tabang!

    nice one. atleast di ta maihas.

  5. #15

    Default Re: tabang in Java. tabang!

    Quote Originally Posted by SuperStar View Post
    Code:
    for(int x=0; x<input.length();x++)
    jairoh, i suggest that you should not use this style of code because it will affect the program during runtime...you'll know a lot of this during your Data Structures subject.

    much better if you'll assign it to a variable, e.g. size like this
    Code:
    size = input.length();
    for(int x=0; x<size ;x++)
    well, explainan tka gamay.. if imo ukayon ang .length() method..you'll see that it will loop individually the charater...so ang mahitabo ana, every increment nimo nag loop pud ang lenght() method which will double the loop imbis dili unta dapat....nahulog nga nag nested loop naka ana imbis linear loop ra imo gibuhat
    Thanks Superstar sa Tip..!

  6. #16

    Default Re: tabang in Java. tabang!

    ....................

  7. #17
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018

    Default Re: tabang in Java. tabang!

    Quote Originally Posted by SuperStar View Post
    suwayi daw ni jairoh if ok ba...bag-o ra ko nahuman code...hehehe....
    comment lang if asa imo wa nasabtan

    simple but rock ang code...
    FYI. La man ko mureklamo sa imo code bai para to kang jairoh tanan akong giingon.
    Sorry kung la maklaro.

    @jairoh - No probs and More power.
    Last edited by Klave; 02-29-2012 at 09:10 PM.

  8. #18

    Default Re: tabang in Java. tabang!

    aw ok...hehehe
    Quote Originally Posted by Klave View Post
    FYI. La man ko mureklamo sa imo code bai para to kang jairoh tanan akong giingon.
    Sorry kung la maklaro.

    @jairoh - No probs and More power.

  9. #19
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018

    Default Re: tabang in Java. tabang!

    To further explain lang sa ... isBrace(stack.peek().toString().charAt(0))

    Ang conditional statements sa java, ato lang ingnon nga TYPE dependent siya rather than EXPRESSION dependent.

    So example ang if clause.

    if( sampleVariable == 1 ){
    }

    Rather than taking "sampleVariable == 1" as an expression. Java evaluated the expression to extract the boolean value.
    Moving on that note, feeding true (kanang true gyud nga dili string) to an if clause will work, but doesn't need further evaluation.
    Of course, feeding an if statement false would make java continue to the else statement.

    if( true ){
    //kani padaganon
    } else{
    }

    if( false ){
    } else{
    //kani padaganon
    }

    Finally, ang isBrace ni Superstar mu-return man og Boolean(true or false). Mao na ingana iyang style gigamit. Pwede ra from kani.

    if (isBrace(stack.peek().toString().charAt(0)))
    {
    stack.pop();
    }

    To kani

    if ( c == '(' || c == ')' ){
    stack.pop();
    }


    Unya to further explain sa pag butang into a variable ang length sa array.
    Naa man gud times, mga manghilabot ta sa array, even during a loop.
    So i-save nimo ang initial value para dili maguba imong loop.

  10. #20
    Elite Member
    Join Date
    May 2011
    Gender
    Male
    Posts
    1,465

    Default Re: tabang in Java. tabang!

    karun pako kasabot ani
    Code:
    if( false ){
    } else{
    //kani padaganon
    }
    Code:
    if (isBrace(stack.peek().toString().charAt(0)))
    {
    stack.pop();
    }
    wa pajud ko au kasabot anang toString().charAt(0) thats why i use somewhat like this one
    Code:
    if ( c == '(' || c == ')' ){
    stack.pop();
    }
    tnx dghan jud ko nakat onan

  11.    Advertisement

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

 
  1. Jeepney fare history in Cebu.. tabang istoryans..
    By nodols3 in forum Business, Finance & Economics Discussions
    Replies: 51
    Last Post: 06-14-2016, 03:27 PM
  2. Tabang mga Java programmers!!!
    By IGN.Boss Wax in forum Programming
    Replies: 4
    Last Post: 11-08-2012, 02:17 PM
  3. How to clear buffer in Java?
    By ares623 in forum Programming
    Replies: 17
    Last Post: 09-22-2009, 11:20 AM
  4. TABANG In good terms mi sa manghod sa ako EX-
    By truelegitballer in forum Relationships (Old)
    Replies: 146
    Last Post: 05-17-2009, 01:04 AM
  5. image bigger than its panel in java
    By manick in forum Programming
    Replies: 4
    Last Post: 09-11-2008, 08:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top