This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DeleteMiddleNode { | |
public static void main( String[] args ) { | |
LinkNode a = new LinkNode ( 5 ); | |
LinkNode b = new LinkNode ( 10 ); | |
LinkNode c = new LinkNode ( 9 ); | |
LinkNode d = new LinkNode ( 4 ); | |
LinkNode e = new LinkNode ( 7 ); | |
a.setNext( b ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class KthToLast { | |
public static void main( String[] args ) { | |
LinkNode head = new LinkNode( 1 ); | |
head.append( new LinkNode( 10 ) ); | |
head.append( new LinkNode( 18 ) ); | |
head.append( new LinkNode( 5 ) ); | |
head.append( new LinkNode( 9 ) ); | |
head.append( new LinkNode( 100 ) ); | |
head.append( new LinkNode( 20 ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashSet; | |
import java.util.Set; | |
public class FindDuplicateLL { | |
public static void main( String[] args ) { | |
LinkNode head = new LinkNode( 1 ); | |
head.append( new LinkNode( 2 ) ); | |
head.append( new LinkNode( 3 ) ); | |
head.append( new LinkNode( 1 ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class PermutationChar { | |
public static void main( String[] args ) { | |
String[] strArray = { "Guo Haoxuan", "Haoxuan Guo" }; | |
System.out.println( isPermutation ( strArray[0], strArray[1] ) ); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class UniqueChar { | |
public static void main( String[] args ) { | |
String[] strArray = { "abcdef", "dssfagagalglag" }; | |
for ( String str : strArray ) | |
System.out.println( isUniqueChar1( str ) ); | |
for ( String str : strArray ) | |
System.out.println( isUniqueChar2( str ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void reverse(char* str){ | |
char* end = str; | |
char temp; | |
while(*end != '\0'){ | |
end++; | |
} | |
end--; |
NewerOlder