Click here to Skip to main content
15,911,711 members
Home / Discussions / Java
   

Java

 
AnswerRe: Java and .NET Pin
427748010-Oct-09 8:32
427748010-Oct-09 8:32 
Question[Message Deleted] Pin
s_a_2002639-Oct-09 2:18
s_a_2002639-Oct-09 2:18 
AnswerRe: Array Subsequence Pin
David Skelly9-Oct-09 2:33
David Skelly9-Oct-09 2:33 
General[Message Deleted] Pin
s_a_2002639-Oct-09 2:37
s_a_2002639-Oct-09 2:37 
GeneralRe: Array Subsequence Pin
42774809-Oct-09 3:10
42774809-Oct-09 3:10 
AnswerRe: Array Subsequence Pin
Nagy Vilmos9-Oct-09 2:49
professionalNagy Vilmos9-Oct-09 2:49 
General[Message Deleted] Pin
s_a_2002639-Oct-09 3:22
s_a_2002639-Oct-09 3:22 
GeneralRe: Array Subsequence Pin
Nagy Vilmos9-Oct-09 3:52
professionalNagy Vilmos9-Oct-09 3:52 
try without the mistakes   Blush | :O :

<pre>      static boolean hasSubsequence(int[] arr, int[] sub) {
            // no match for the outer loop
            // this will exit when a match is found
            boolean matched = false;
            for (int i = 0; i <= arr.length - sub.length &amp;&amp; !matched; i++) {
                  // start off matched for the inner loop        
                  // this will exit when a mismatch is found        
                  matched = true;
                  for (int j = 0; j < sub.length &amp;&amp; matched; j++) {
                        matched = (arr[i+j] == sub[j]);
                  }
            }  
            // at this point mayched is true if sub is inside arr  
            return matched;
      }</pre>

Exercise for you is to work out WHY it was wrong....



Panic, Chaos, Destruction.
My work here is done.

QuestionJava Intenet Jobs.... Pin
TGeist8-Oct-09 18:33
TGeist8-Oct-09 18:33 
AnswerRe: Java Intenet Jobs.... Pin
Richard MacCutchan8-Oct-09 22:49
mveRichard MacCutchan8-Oct-09 22:49 
AnswerRe: Java Intenet Jobs.... Pin
42774809-Oct-09 3:12
42774809-Oct-09 3:12 
GeneralRe: Java Intenet Jobs.... Pin
Richard MacCutchan9-Oct-09 4:31
mveRichard MacCutchan9-Oct-09 4:31 
GeneralRe: Java Intenet Jobs.... Pin
42774809-Oct-09 6:29
42774809-Oct-09 6:29 
QuestionParsing Text Files and Spliting on '&gt;' Pin
meixiang68-Oct-09 14:09
meixiang68-Oct-09 14:09 
AnswerRe: Parsing Text Files and Spliting on '&gt;' Pin
42774809-Oct-09 3:13
42774809-Oct-09 3:13 
GeneralRe: Parsing Text Files and Spliting on '&gt;' Pin
meixiang69-Oct-09 4:22
meixiang69-Oct-09 4:22 
GeneralRe: Parsing Text Files and Spliting on '&gt;' Pin
42774809-Oct-09 6:20
42774809-Oct-09 6:20 
GeneralRe: Parsing Text Files and Spliting on '&gt;' Pin
meixiang69-Oct-09 8:56
meixiang69-Oct-09 8:56 
GeneralRe: Parsing Text Files and Spliting on '&gt;' Pin
42774809-Oct-09 9:42
42774809-Oct-09 9:42 
GeneralRe: Parsing Text Files and Spliting on '&gt;' Pin
meixiang69-Oct-09 9:56
meixiang69-Oct-09 9:56 
Question12 days of christmas Pin
Shah Ravi8-Oct-09 9:05
Shah Ravi8-Oct-09 9:05 
AnswerRe: 12 days of christmas Pin
Wes Aday8-Oct-09 9:51
professionalWes Aday8-Oct-09 9:51 
GeneralRe: 12 days of christmas Pin
Shah Ravi8-Oct-09 10:19
Shah Ravi8-Oct-09 10:19 
GeneralRe: 12 days of christmas Pin
David Skelly8-Oct-09 22:13
David Skelly8-Oct-09 22:13 
AnswerRe: 12 days of christmas Pin
42774809-Oct-09 3:16
42774809-Oct-09 3:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.